Closed
Description
Issue
I have a complex query:
select * from `profiles` where (profiles.user_id not in(?) and profiles.active = 1)
and (profiles.user_id in(select user_id from user_interests where interest_id in(?))
or profiles.user_id in(select user_id from user_locations where region_id in(?))
or profiles.user_id in(select user_id from profiles where country_id = ?))
which I call like this:
$data['suggestedConnections'] = Profile::whereRaw('(profiles.user_id not in(?) and profiles.active = 1)
and (profiles.user_id in(select user_id from user_interests where interest_id in(?))
or profiles.user_id in(select user_id from user_locations where region_id in(?))
or profiles.user_id in(select user_id from profiles where country_id = ?))',
array($excludedIds, $includedInterests, $includedRegions, $location))
->limit(10)
->inRandomOrder()
->get();
$excludedIds, $includedInterests, $IncludedRegions are all arrays of ids
and $location is an integer.
I really don't want this query to be cached (or maybe a better way to put it is that I want this query to be excluded from the query cache, but I want the rest of the queries on the model to be cached).
I'm wondering if anything using a raw method https://laravel.com/docs/5.5/queries#raw-expressions should bypass the cache?
Alternatively is there a way I can clear that cache or skip caching or a given query?
Environment
Laravel Version: 5.5
Laravel Model Caching Package Version: 0.2.11
PHP Version: 7.1.10
Homestead Version: N/A
Operating System & Version: OSX High Sierra
Metadata
Metadata
Assignees
Labels
No labels