In my project I am using Laravel 5.1 with Mongo, And to reduce DB calls I am using redis as caching layer. But in some Collections I have around 60-70k documents and at some point of my application I only need 40-50 documents with filtering. To get those 50-60 records I need to fetch all documents from redis cache with key and then have to filter all data on application level. Currently what I am doing is below :-
$collectionObj = Cache::get($Collection); // return data from cache as modal
$collectionObj = $collectionObj->filter(function($val){
// filtering logic
// where condition
return true;
})
My question is :- is there any way to get data from redis as we fetch data from DB like
DB::collection($Collection)->where($cond1)->where($cond2)->get();
So am looking something from by using that I can get data from redis like above.
Redis::get($key)->where($cond)->get()
Or any other way to get this data in optimized way.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire