cabol / nebulex_examples

Nebulex Examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Near Cache Topology – Writes are not updating L1 Cache on another nodes of the cluster

HammamSamara opened this issue · comments

It seems however I try to update a key on one node, the other nodes which have seen the key before won't update their L1 cache.
Besides setting a ttl value on L1, is there anyway to invalidate the L1 on other nodes upon updating?
I am having a situation where I can't serve a stale value once a newer version of data runs over the cluster.

Example:

iex(node1@127.0.0.1)> NearCache.put "foo", "bar"
:ok

iex(node2@127.0.0.1)> NearCache.get "foo"          
"bar"

iex(node1@127.0.0.1)> NearCache.put "foo", "new bar"
:ok

iex(node2@127.0.0.1)> NearCache.get "foo"          
"bar"

iex(node2@127.0.0.1)> NearCache.get "foo", level: 2        
"new bar"

iex(node1@127.0.0.1)> NearCache.replace "foo", "baz"
:ok

iex(node2@127.0.0.1)> NearCache.get "foo"          
"bar"