On Thursday, September 5, 2013 12:00:32 AM UTC-7, Joshua Hansen wrote:
>
> Or:
>>
>>   User[:email =>'[email protected]'].update(:email=>'[email protected]
>> ') 
>>
>   User[:email =>'[email protected]'] # what's the result?
>>
>
> This one should actually work just fine. Dataset#update deletes the cache 
> related to the dataset. The cache is wiped before the actual update is 
> executed so the result would be nil.
>

This is Model#update, not Dataset#update, and looking at 
https://github.com/binarypaladin/sequel-query-cache/blob/master/lib/sequel-query-cache/instance_methods.rb#L55,
 
it appears as though it could cause an issue (at least if the initial 
dataset is cached).  The problem is that if a model instance was retrieved 
by a cachable dataset with a LIMIT of 1, it sets the cache for the dataset 
to be the object, without considering if changes to the object would cause 
it to no longer match the dataset's conditions.

I didn't actually try running the code, so I could be completely wrong. :)

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to