renoki-co / laravel-eloquent-query-cache

Adding cache on your Laravel Eloquent queries' results is now a breeze.
Apache License 2.0
1.04k stars 108 forks source link

cacheFor(0) would cache forever? #204

Closed flycoo closed 11 months ago

flycoo commented 11 months ago

$Test = Test::cacheFor(0)->where('ip', '127.0.0.1')->first();

as the code above. when I delete my record from db, the $Test remain would be retreive and it's not null

modrink commented 11 months ago

According to the source, caching forever can be done by using

    /**
     * Indicate that the query results should be cached forever.
     *
     * @return \Illuminate\Database\Query\Builder|static
     */
    public function cacheForever()
    {
        return $this->cacheFor(-1);
    }