ngmoco / cache-money

A Write-Through Cacheing Library for ActiveRecord
Apache License 2.0
161 stars 31 forks source link

TTL - not having an effect - memcache.yml #1

Closed kaitos closed 14 years ago

kaitos commented 14 years ago

I am setting a ttl in my memcache.yml file but I noticed that is has no effect on the actual expire time of the model. The ttl is always the value set in the index.rb (DEFAULT_OPTIONS)

I can set the :ttl as an optional value in the model directly tied to the index; ex index :hrq_id, :ttl => 60.

Does anyone know how to globally add the ttl back to the .yml file? Or we should change the documentation to not include the ttl in the memcache.yml file.

thanks

ngmoco commented 14 years ago

The ttl in the memcached.yml file sets the default_ttl in the memcached wrapper. It was not being passed down to cache-money. The way cache-cache was expecting the ttl was through the options in the is_cached call. I have changed it to use the default ttl if one is not passed down through options.

ashleym1972 commented 14 years ago

BTW if you could write a test case for this I would be in your debt.