Update
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
]);
|
||||
|
||||
$middleware->statefulApi();
|
||||
|
||||
$middleware->alias([
|
||||
'cacheResponse' => \Spatie\ResponseCache\Middlewares\CacheResponse::class,
|
||||
'doNotCacheResponse' => \Spatie\ResponseCache\Middlewares\DoNotCacheResponse::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"laravel/tinker": "^2.10.1",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
"pgvector/pgvector": "^0.2.2",
|
||||
"spatie/laravel-responsecache": "^7.7",
|
||||
"tightenco/ziggy": "^2.4",
|
||||
"vinkla/hashids": "^13.0"
|
||||
},
|
||||
|
||||
146
composer.lock
generated
146
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "0eb9aa0064d3f45310f7c703ca9cf519",
|
||||
"content-hash": "160f6df94011c1b101a9fc69cf0bd4b6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "artesaos/seotools",
|
||||
@@ -4037,6 +4037,150 @@
|
||||
],
|
||||
"time": "2024-04-27T21:32:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-package-tools",
|
||||
"version": "1.92.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-package-tools.git",
|
||||
"reference": "d20b1969f836d210459b78683d85c9cd5c5f508c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/d20b1969f836d210459b78683d85c9cd5c5f508c",
|
||||
"reference": "d20b1969f836d210459b78683d85c9cd5c5f508c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^9.28|^10.0|^11.0|^12.0",
|
||||
"php": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.5",
|
||||
"orchestra/testbench": "^7.7|^8.0|^9.0|^10.0",
|
||||
"pestphp/pest": "^1.23|^2.1|^3.1",
|
||||
"phpunit/php-code-coverage": "^9.0|^10.0|^11.0",
|
||||
"phpunit/phpunit": "^9.5.24|^10.5|^11.5",
|
||||
"spatie/pest-plugin-test-time": "^1.1|^2.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\LaravelPackageTools\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Tools for creating Laravel packages",
|
||||
"homepage": "https://github.com/spatie/laravel-package-tools",
|
||||
"keywords": [
|
||||
"laravel-package-tools",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-package-tools/issues",
|
||||
"source": "https://github.com/spatie/laravel-package-tools/tree/1.92.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-04-11T15:27:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-responsecache",
|
||||
"version": "7.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-responsecache.git",
|
||||
"reference": "d551f0498dbb2d98df47359364e5a1c8203a6376"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-responsecache/zipball/d551f0498dbb2d98df47359364e5a1c8203a6376",
|
||||
"reference": "d551f0498dbb2d98df47359364e5a1c8203a6376",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/cache": "^10.0|^11.0|^12.0",
|
||||
"illuminate/console": "^10.0|^11.0|^12.0",
|
||||
"illuminate/container": "^10.0|^11.0|^12.0",
|
||||
"illuminate/http": "^10.0|^11.0|^12.0",
|
||||
"illuminate/support": "^10.0|^11.0|^12.0",
|
||||
"nesbot/carbon": "^2.63|^3.0",
|
||||
"php": "^8.2",
|
||||
"spatie/laravel-package-tools": "^1.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/framework": "^10.0|^11.0|^12.0",
|
||||
"mockery/mockery": "^1.4",
|
||||
"orchestra/testbench": "^8.0|^9.0|^10.0",
|
||||
"pestphp/pest": "^2.22|^3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"ResponseCache": "Spatie\\ResponseCache\\Facades\\ResponseCache"
|
||||
},
|
||||
"providers": [
|
||||
"Spatie\\ResponseCache\\ResponseCacheServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\ResponseCache\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Speed up a Laravel application by caching the entire response",
|
||||
"homepage": "https://github.com/spatie/laravel-responsecache",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"laravel",
|
||||
"laravel-responsecache",
|
||||
"performance",
|
||||
"response",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/spatie/laravel-responsecache/tree/7.7.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://spatie.be/open-source/support-us",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-05-20T08:39:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.2.0",
|
||||
|
||||
94
config/responsecache.php
Normal file
94
config/responsecache.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
* Determine if the response cache middleware should be enabled.
|
||||
*/
|
||||
'enabled' => env('RESPONSE_CACHE_ENABLED', true),
|
||||
|
||||
/*
|
||||
* The given class will determinate if a request should be cached. The
|
||||
* default class will cache all successful GET-requests.
|
||||
*
|
||||
* You can provide your own class given that it implements the
|
||||
* CacheProfile interface.
|
||||
*/
|
||||
'cache_profile' => Spatie\ResponseCache\CacheProfiles\CacheAllSuccessfulGetRequests::class,
|
||||
|
||||
/*
|
||||
* Optionally, you can specify a header that will force a cache bypass.
|
||||
* This can be useful to monitor the performance of your application.
|
||||
*/
|
||||
'cache_bypass_header' => [
|
||||
'name' => env('CACHE_BYPASS_HEADER_NAME', null),
|
||||
'value' => env('CACHE_BYPASS_HEADER_VALUE', null),
|
||||
],
|
||||
|
||||
/*
|
||||
* When using the default CacheRequestFilter this setting controls the
|
||||
* default number of seconds responses must be cached.
|
||||
*/
|
||||
'cache_lifetime_in_seconds' => (int) env('RESPONSE_CACHE_LIFETIME', 60 * 60 * 24 * 7),
|
||||
|
||||
/*
|
||||
* This setting determines if a http header named with the cache time
|
||||
* should be added to a cached response. This can be handy when
|
||||
* debugging.
|
||||
*/
|
||||
'add_cache_time_header' => env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
* This setting determines the name of the http header that contains
|
||||
* the time at which the response was cached
|
||||
*/
|
||||
'cache_time_header_name' => env('RESPONSE_CACHE_HEADER_NAME', 'laravel-responsecache'),
|
||||
|
||||
/*
|
||||
* This setting determines if a http header named with the cache age
|
||||
* should be added to a cached response. This can be handy when
|
||||
* debugging.
|
||||
* ONLY works when "add_cache_time_header" is also active!
|
||||
*/
|
||||
'add_cache_age_header' => env('RESPONSE_CACHE_AGE_HEADER', false),
|
||||
|
||||
/*
|
||||
* This setting determines the name of the http header that contains
|
||||
* the age of cache
|
||||
*/
|
||||
'cache_age_header_name' => env('RESPONSE_CACHE_AGE_HEADER_NAME', 'laravel-responsecache-age'),
|
||||
|
||||
/*
|
||||
* Here you may define the cache store that should be used to store
|
||||
* requests. This can be the name of any store that is
|
||||
* configured in app/config/cache.php
|
||||
*/
|
||||
'cache_store' => env('RESPONSE_CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
* Here you may define replacers that dynamically replace content from the response.
|
||||
* Each replacer must implement the Replacer interface.
|
||||
*/
|
||||
'replacers' => [
|
||||
\Spatie\ResponseCache\Replacers\CsrfTokenReplacer::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* If the cache driver you configured supports tags, you may specify a tag name
|
||||
* here. All responses will be tagged. When clearing the responsecache only
|
||||
* items with that tag will be flushed.
|
||||
*
|
||||
* You may use a string or an array here.
|
||||
*/
|
||||
'cache_tag' => '',
|
||||
|
||||
/*
|
||||
* This class is responsible for generating a hash for a request. This hash
|
||||
* is used to look up a cached response.
|
||||
*/
|
||||
'hasher' => \Spatie\ResponseCache\Hasher\DefaultHasher::class,
|
||||
|
||||
/*
|
||||
* This class is responsible for serializing responses.
|
||||
*/
|
||||
'serializer' => \Spatie\ResponseCache\Serializers\DefaultSerializer::class,
|
||||
];
|
||||
@@ -21,4 +21,4 @@
|
||||
require __DIR__.'/auth.php';
|
||||
}
|
||||
|
||||
Route::get('/', [FrontHomeController::class, 'index'])->name('home');
|
||||
Route::get('/', [FrontHomeController::class, 'index'])->name('home')->middleware('cacheResponse:3600');
|
||||
|
||||
Reference in New Issue
Block a user