Category : caching

I have a schedule task which runs every 5 minutes. This schedule command puts some data to Redis cache via controller. Kernel.php … protected $commands = [ CommandsDataCommand::class, ]; protected function schedule(Schedule$schedule) { $schedule->command(‘data:cache’)->everyFiveMinutes()->onOneServer()->runInBackground(); } DataCommand.php … public function handle() { app(‘AppHttpControllersDataProcessing’)->setCache(); } DataProcessing.php … public function setCache() {$data = [‘one’, ‘two’, ‘three’]; ..

Using Windows. I want to write and call a .sh script which will contain: ssh [email protected] cd /var/www/api.name.com php artisan cache:clear php artisan responsecache:clear php artisan config:cache At the moment it’ll just login but not navigate to the directory or run the php artisan parts. I will then schedule this to run with windows task ..

I’ve just taken over a Laravel project that was abandoned by the previous developers and to whom I now have no contact. On the live website the pages reference urls that all end in ".htm". For various reasons I would prefer not to share the public url to this site here although I could maybe ..

I’m having a slight issue with my control panel using Statamic. If I make a change to my settings such as changing a toggle from on to off, it says that it was saved successfully. If I then refresh the page it reverts back to what it was before (on). If I then refresh the ..

I’m having a slight issue with my control panel using Statamic. If I make a change to my settings such as changing a toggle from on to off, it says that it was saved successfully. If I then refresh the page it reverts back to what it was before (on). If I then refresh the ..

How to Disable Cache of Credentials Database Username and Password from .env File get the credentials from Private Subnet API when i make every request i get the credentials and set to config database.php credentials file, but i don’t want to Laravel to cache it for security issuse Sourc..

I want to delete all the keys in redis except ones that start with: cars- I am able to clear all keys or specific keys starting with a prefix. Can anyone advise how I could do this in Laravel? Sourc..

I have some troubles with Laravel views cache now. Thanks for any help. After pushed the latest updates to server, I did to run the commands below. Not sure why it always shows me old content and I tried to clear the cache manually, definitely I can see the views cache files disappear at folder ..

It’s been a few days now, that my changes in the code (controller, event, blade or any other php files) are not reflected at runtime. For my changes to be taken into consideration, I have to close my code editor (VSCode) and open it again and type the command "npm run watch" even for PHP ..

Firstly I’m sorry. My english is bad. I need caching laravel storage image for my React Native app. How I send my image with cache control header? Sourc..

Firstly I’m sorry. My english is bad. I need caching laravel storage image for my React Native app. How can I send my image with cache control header? Sourc..

i just wondering what is the best practice to store value cache in file system Or in memory In terms of performance i don’t want use Redis cache or any software just want to used either (memory cache OR file cache) to cache so file for period of time Sourc..

My problem is that when I use caching in Laravel with file driver, I occassionally lose permissions to the cache file. Permissions are set properly, parent folder does not lose any permissions, only the specific cache file. After restarting the machine, permissions are back and I can delete the file manually. The "permission" error is ..

I have a problem with two models, Facility and Certificate. When I created these models I just copied the code from Facility.php to Certificate.php and forgot about it. Well when it was time to start working with the Certificate.php file I saw that it just was a copy of Facility.php so I changed it and ..

I’m trying to remember cache for 6 minute on home page but it’s errors. I want 10 parameters in one key ( homepage-data ) so what i’m doing wrong? public function index() { $rememberKey = ‘homepage-data’;$minutes = 600; Cache::remember($rememberKey,$minutes, function () { $breakingNews = BreakingNews::published();$rightSlider = Article::rightSlider()->take(20)->get(); $leftSlider = Article::leftSlider()->take(9)->get();$shows = ..

Background I created a custom auth middleware to check if user is already logged in. If logged user visit login page, it redirects him to dashboard. If non-logged user visit dashboard page, it redirects him to the login page. I use LaravelLocalization as multi language plugin. Problem During testing, everything works fine. I could login, ..

We are serving multiple tenants with a laravel application, switching between tenants with: config([‘cache.prefix’ => $cachePrefix]); Cache::setPrefix($cachePrefix); Then sometimes when we call: Cache::tags(‘TagName’)->add($model->getTable(), 1,$this->refreshTime); We get this stack trace: ErrorException unserialize(): Error at offset 0 of 2 bytes /usr/share/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:345 IlluminateFoundationBootstrapHandleExceptions::handleError [internal] unserialize /usr/share/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:345 IlluminateCacheRedisStore::unserialize /usr/share/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:64 IlluminateCacheRedisStore::get /usr/share/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php:87 IlluminateCacheTagSet::tagId [internal] array_map /usr/share/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php:76 IlluminateCacheTagSet::tagIds /usr/share/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php:66 IlluminateCacheTagSet::getNamespace ..

Laravel Version: 8..4 PHP Version: 7.4.3 Database Driver & Version: mysql Ver 8.0.26-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu)) Description: I have a live laravel website running on aws ebs. I entered the admin panel with laravel voyager to run some php artisan commands with laravel voyager compass. I first ran ‘php artisan view:cache’ and it ..

The documentation doesn’t seem to be quite updated yet, and the answers on the net are mostly wrong, but if you want to have a ‘dev’ version of a queue worker/processor/listener, then use the ‘queue:listen’ option instead of the ‘queue:work’ option. ‘queue:work’ will absolutely cache everything, and nothing in the world save for killing the ..

Im using laravel 8 and i want to use command "php artisan optimize" to cache config and route of my app after deploy app from github to heroku. The problem is i dont know how where should i put that command in. I tried to put into composer.json file and run the script in the ..

I’v been having an issue with Laravel producing HTTP code 500 – "No application encryption key has been specified" -error randomly on my rest-routes. Of course I have set, and even reset the key with Artisan, so that shouldn’t be the issue. This issue has always been present, ever since I started my project on ..

I’v been having an issue with Laravel producing HTTP code 500 – "No application encryption key has been specified" -error randomly on my rest-routes. Of course I have set, and even reset the key with Artisan, so that shouldn’t be the issue. This issue has always been present, ever since I started my project on ..

I am trying to optimize a project that is working pretty slow using caching. I’m facing a problem that I don’t quite understand how to cache full eloquent models with their relationships and later on covert them back to a model with all relations intact. Here’s a fragment of my code if (Cache::has($website->id.’_main_page’)) {$properties ..

After running this command php artisan config:clear in laravel 5.6, I’m facing this issue: Now neither the config:clear is working nor the project is running. Sourc..

We’re using Laravel (8) rate limiter and running into constant duplicate key violations in our cache table. Postgres is throwing fits because of the constant attempts to write to the cache with the same key. We’re getting duplicate key value violates unique constraint "cache_key_unique" errors, and it looks like every time (and with everyone) it’s ..