sasa1977 / con_cache

ets based key/value cache with row level isolated writes and ttl support
MIT License
910 stars 71 forks source link

Items don't expire any more #45

Closed stevenwu closed 6 years ago

stevenwu commented 6 years ago

Recently, I noticed that cache items don't expire anymore. Results from a new phoenix v1.3.2 app:

iex(2)> {:ok, cache} = ConCache.start_link(ttl_check_interval: :timer.seconds(1), global
_ttl: :timer.seconds(5))
{:ok, #PID<0.403.0>}
iex(3)> ConCache.put(cache, :foo, :bar)
:ok
iex(4)> ConCache.get(cache, :foo)
:bar
iex(5)> :timer.sleep(:timer.seconds(10))
:ok
iex(6)> ConCache.get(cache, :foo)
:bar
iex(7)>

Am I missing something? Thanks.

sasa1977 commented 6 years ago

Which version are you using. If you're fetching the dependency from hex, then the readme in GitHub is not correct. Instead of using ttl_check_interval and global_ttl, you should use ttl_check and ttl (see here).

The reason for this discrepancy is that there has been a change in the interface, but the GitHub master is not yet pushed.

stevenwu commented 6 years ago

I am on 0.12. That fixed it, thank you.