Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom ttl on mulltilevel cache gets overwritten #46

Closed
bbassett opened this issue Apr 17, 2019 · 3 comments
Closed

custom ttl on mulltilevel cache gets overwritten #46

bbassett opened this issue Apr 17, 2019 · 3 comments
Labels

Comments

@bbassett
Copy link

bbassett commented Apr 17, 2019

Hi cabol! thanks so much for the work you've put into this. I've found a weird bug that i can't sort out. I have a Mutlilevel cache with Local and Dist adapters implemented, just the same as in your examples, but if i set a custom ttl on a record, when i get that record, the expire_at value gets overwritten to be something similar to desired_ttl - (DateTime.utc_now() |> DateTime.to_unix()) and happens again if i rapidly call get a second time, here's an example from the repl:

iex(node1@dell)209> Simple.Service.Cache.set("awesome", "sauce", [ttl: 60, return: :object])
%Nebulex.Object{
  expire_at: 1555474083,
  key: "awesome",
  value: "sauce",
  version: nil
}
iex(node1@dell)210> Simple.Service.Cache.get("awesome", [return: :object])
Nebulex.Adapters.Multilevel
%Nebulex.Object{
  expire_at: 53,
  key: "awesome",
  value: "sauce",
  version: nil
}
iex(node1@dell)211> Simple.Service.Cache.get("awesome", [return: :object])
Nebulex.Adapters.Multilevel
%Nebulex.Object{
  expire_at: -1555473977,
  key: "awesome",
  value: "sauce",
  version: nil
}
iex(node1@dell)212> Simple.Service.Cache.get("awesome", [return: :object])
Nebulex.Adapters.Multilevel
nil

also, i'm currently running 3 nodes which are all connected, and i just found this, which looks like it could be the culprit:
https://github.com/cabol/nebulex/blob/master/lib/nebulex/adapters/multilevel.ex#L417

@cabol
Copy link
Owner

cabol commented Apr 17, 2019

@bbassett thanks for report the issue, I'll take a look at it soon!

@cabol
Copy link
Owner

cabol commented Apr 24, 2019

@bbassett I think the bug is fixed now. Please try it out again and let me know if the issue persist. Thanks :) !!

@cabol
Copy link
Owner

cabol commented Apr 26, 2019

I will close the issue for now, feel free to re-open it if the problem persist.

@cabol cabol closed this as completed Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants