cache invalidation with memcache backend

Skip to first unread message

Phang Mulianto

Mar 2, 2018, 1:16:05 AM3/2/18
to ChicagoBoss
HI ,

I have a question regarding the cache invalidation on the db query.

i read in the doc that the cache will auto invalidated when there is changes in the records by update the model.
it  is automaticaly by the boss news mechanism.

But in my case , thats not happend. i set the cache life time to 60 s in the boss config.

Anything that i miss for this invalidation to happend. The boss news already start, it show up a notification when we save the model.


Dmitry Polyanovsky

Mar 10, 2018, 11:22:24 AM3/10/18
to ChicagoBoss

can you provide some code to clarify that you are trying to do?

Mar 15, 2018, 6:28:10 PM3/15/18
to ChicagoBoss
Hi Dmitry,

so my code do just basic flow when edit a record in cb.

1. find the data with the id.
2. set the new data from the returned data.
3. save the data

let say a phone table with name field. i edit the name.

>A =  boss_db:find("phone-1").
>U = A:set(name, "Donald").
> U:save().
> boss_db:find("phone-1").

This should return the updated record with Donald as name.
But in the code, the name is updated after the cache expired. i set the cache to 60s by the way, whichi default in CB. cache using memcached in debian.

This also happend on a list of records. When 1 udpated, the list not updated when returned from cb.

what i m trying to do was do the cache should invalidate by the expired time or on update / change on the model / records.

i assume the cache invalidation should works without trigger anything.

Reply all
Reply to author
0 new messages