-
Notifications
You must be signed in to change notification settings - Fork 74
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
The match spec in the doc should be of size 5 instead of size 4 #146
Comments
Hey! First of all, sorry about that, I was checking out the docs and there are parts outdated, so that is an issue, I will try to fix the docs accordingly. Regarding the tuple, in the local adapter, the entry is an Elixir record, like so: defrecord(:entry,
key: nil,
value: nil,
touched: nil,
ttl: nil
) This means it would be a tuple with 5 element like so: There is also an example in the docs c:Nebulex.Cache.all/2 Please let me know if that helps, and also I will try to fix the wrong docs ASAP. Thanks! |
Thank you very much Cabol. I have some questions concerning checking for expiry. Nebulex.Time.now() > (touched + ttl) Or I can just skip that expiry check since the query will guarantee that I will always get unexpired results. |
You have to validate it in the query. There is a build-in query for retrieving the unexpired entries spec = [
{{:entry, :"$1", :"$2", :_, :_},
[{:orelse, {:==, :"$4", :infinity}, {:<, {:-, Nebulex .Time.now(), :"$3"}, :"$4"}}],
[{{:"$1", :"$2"}}]}
]
MyCache.all(spec) |
Thank you Cabol I will try what you suggested. |
Recently, we had to update our app from using nebulex from 1.2.2 which was running on elixir 1.8.2 and otp 22.0 to nebulex version 2.3.0 on elixir 1.12 and otp 24.0. We were facing errors that our Ex2ms queries that we were using in the form of a tuple of four values
{key, value, version, expire_at}
got failed.I've looked everywhere including hex document, elixirforum, and other sources of what could go wrong. but eventually, I found out in the spec that we are supposed to use is a tuple of 5 values instead.
nebulex/test/shared/local_test.exs
Lines 114 to 118 in b17def1
So we updated our code according to use tuples of 5 values instead. And our tests got passed successfully.
Could you explain more in term of a tuple of 5 values what each value are? As my current try I found out that only that what are the value for key, value and expire_at which are in the form of {_, key, value, expire_at, _}. I wonder what are the rest of the two values are.
And also please let's me know if you need me to make a pull request to update the doc also.
The text was updated successfully, but these errors were encountered: