I am using ConCahe for saving an image with its modified timestamps. It works fine, normally, and when I say normally then it works fine in logs as
def update_cache_and_save_thumbnail(camera_exid, timestamp, image) do
{last_save_date, t, img} = ConCache.dirty_get_or_store(:camera_thumbnail, camera_exid, fn() ->
{Calendar.DateTime.now!("UTC"), timestamp, image}
end)
Logger.info "This is dirty get or store"
IO.inspect ConCache.get(:camera_thumbnail, camera_exid)
Logger.info "==========================="
case Calendar.DateTime.diff(Calendar.DateTime.now!("UTC"), last_save_date) do
{:ok, seconds, _, :after} ->
thumbnail_save_seaweedfs(camera_exid, image, timestamp, last_save_date, seconds)
Logger.info "This is after thumnail save_seaweedfs"
IO.inspect ConCache.get(:camera_thumbnail, camera_exid)
Logger.info "==========================="
_ ->
Logger.info "This is will never run i think"
IO.inspect ConCache.get(:camera_thumbnail, camera_exid)
Logger.info "==========================="
ConCache.dirty_put(:camera_thumbnail, camera_exid, {last_save_date, timestamp, image})
end
end
when this function run and I am calling ConCache.get(:camera_thumbnail, "blessington_court") in between and it's giving me an updated value right away. such as
for once it gives duplicate but that's because it's been looking in cache. but whenever I do in the remote console as ConCache.get(:camera_thumbnail, "blessington_court"), It always gives the very old value. not the updated one.
I have read the module docs for concache, But I didn't find anything suitable which can pas the theory that it will give new value right away but old one when I can method by myself.? Can you guide me what is wrong happening in this? I tried this several times but it's giving me an old value always.
I am using ConCahe for saving an image with its modified timestamps. It works fine, normally, and when I say normally then it works fine in logs as
when this function run and I am calling
ConCache.get(:camera_thumbnail, "blessington_court")
in between and it's giving me an updated value right away. such asfor once it gives duplicate but that's because it's been looking in cache. but whenever I do in the remote console as ConCache.get(:camera_thumbnail, "blessington_court"), It always gives the very old value. not the updated one.
I have read the module docs for concache, But I didn't find anything suitable which can pas the theory that it will give new value right away but old one when I can method by myself.? Can you guide me what is wrong happening in this? I tried this several times but it's giving me an old value always.