Ruby 1.9 fixes, Limit of 1 for has_one, Remove Freeze for Dalli encoding#3
Ruby 1.9 fixes, Limit of 1 for has_one, Remove Freeze for Dalli encoding#3orslumen merged 12 commits intoorslumen:masterfrom blmundie:master
Conversation
|
Thanks for the pull-request. I am not using ruby 1.9 yet, so those changes are very welcome and removing the freeze's is fine by me too. The reason why record cache does not allow for :limit > 1 queries is that it is usually combined with sorting and large amounts of data, in which case the DB is probably faster than retrieving all records first and then sort + limit in memory. To make sure only the has_one case is supported by the index_cache, I propose: Would it be possible to add a has_one relation to the test model and write some specs? Especially the part of cache invalidation on delete is now missing. Thanks again for your contribution, |
|
I added the test and put the sorted check |
Ruby 1.9 fixes, Limit of 1 for has_one, Remove Freeze for Dalli encoding
|
Thanks again for your contribution, it will be part of the next release. |
I allowed limits of 1 to make has_one work. I made it work by cutting the size of the records array after the cache hit. This could work for any limit size, but I wasn't sure if you were concerned about performance.
I had an issue where dalli was trying to change the encoding of the key strings that were frozen. I removed the freeze on them. I'm not sure if this is a ruby 1.9 issue.
The other fixes were basic changes for ruby 1.9.