Closed rifqiakrm closed 4 years ago
@rifqiakrm Thanks for reporting this. By any chance, would you be able to provide a sample repo that replicates this issue? I don't use Lumen, and the unit tests aren't geared toward Lumen, so at the moment I am unable to test it with Lumen.
@mikebronner Sorry for the late response. Kinda busy at the time. I'll try to create a sample repo you. See you in a bit.
Hi @mikebronner, I've created a repository for you to test. You can clone it in here https://github.com/rifqiakrm/sample-query-cache-lumen
@rifqiakrm Thanks for doing that! I will look into it soon :)
@rifqiakrm Got the repo cloned. What do I do to reproduce the issue?
@mikebronner I have similar issue. I tried to inspect the cache operation using Clockwork, there wasn't any operation to get from Cache.
@rhzs Sorry, not sure how to help you there. If you can provide an error, or a point of failure, or a failing test, I'll be happy to help. I'm not seeing anything wrong when running the test suite. I don't test against Lumen, as I don't use it, but it should generally work.
@mikebronner You just have to migrate and seed the database, run php artisan serve, and then hit localhost:8000/tags and see the keys on redis-cli if it's there or not.
The controller code is on app/Http/Controllers/ExampleController.php
and the model is on app/Models/Tag.php
my .env configuration
CACHE_DRIVER=redis
REDIS_CLIENT=predis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=mypassword
REDIS_PORT=6379
@rifqiakrm Awesome, thanks for that ... I didn't know what routes you were using etc. Will try that now.
@rifqiakrm So I found out what is happening: the config file is not being loaded in your Lumen app. You need to update Lumen to load config files, and if necessary publish the config file from the package to your Lumen app to where it loads config files.
Issue
Hey, thank you for creating this library! It helps me a lot in building some of my projects.
But, I am facing some issues after I installed this library on Lumen. It seems like cachable trait not caching my models. I've been trying to add it to another model that I have but no luck. Am I missing configuration or something? Here is my code
composer.json
bootstrap/app.php
.env file
This is what I get on redis-cli
Environment
Lumen Version: 7.0 Laravel Model Caching Package Version: 0.8.10 PHP Version: 7.4.8 Operating System & Version: Ubuntu 18.04.3 LTS