You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 4, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 4, 2022. It is now read-only.
One of the main reasons for me to use Redis is as a cache; so it is very important that I can insert keys with specify expires (using Redis; not my own custom expires_in member).
In my exploring, I can't find such feature. I think Stdnet doesn't support it.
Because, Stdnet intends to support multi-backend which may not support expiring entry.
For now, manual deleting (by creation/update datetime) using model is only way.
I think this is only way for consistency.
Many NoSQL stores support this feature, for those that don't you can handle it manually (e.g.: push a timestamp on each expirable record, on get requests check if it's still valid before returning to requester, if expired delete from db)
stdnet is a data mapper, one instance of a model can have several keys associated with it. For example, in redis an object has a key for the hash, a key for every index (either sets or zset) and few others for internal use.
In this respect, it doesn't make lots of sense talking about expiring keys in stdnet, expiring objects could be the equivalent. Such feature is not available, if you need to expire them you can do it programmatically by deleting them.
If you are using redis as a cache, why do you need the object data mapping of stdnet?
Do you want to expire keys or objects?
Can you share your use case?
I thought also the feature before.
A case is making an ephemeral odm object by TTL.
In redis, automatic expiring redis object is supported natively, and it prevents code bugs which related to deleting.
But in stdnet, such object may break system data structure.
By writing above, I got an idea. Let me explain.
introduce a field for TTL, called "_ttl" here.
if a odm object specified as ephemeral object and related backend supports it, set correspond TTL value for the field in Hash.
in retrieving the object in Lua script, returns none if the TTL is over.
also delete the object in stdnet.
How about this? We can do the step 1, but step 2-4 needs stdnet support.
Activity
jbking commentedon Sep 16, 2014
In my exploring, I can't find such feature. I think Stdnet doesn't support it.
Because, Stdnet intends to support multi-backend which may not support expiring entry.
For now, manual deleting (by creation/update datetime) using model is only way.
I think this is only way for consistency.
SamuelMarks commentedon Sep 16, 2014
Many NoSQL stores support this feature, for those that don't you can handle it manually (e.g.: push a timestamp on each expirable record, on get requests check if it's still valid before returning to requester, if expired delete from db)
lsbardel commentedon Sep 17, 2014
stdnet is a data mapper, one instance of a model can have several keys associated with it. For example, in redis an object has a key for the
hash, a key for every index (eithersetsorzset) and few others for internal use.In this respect, it doesn't make lots of sense talking about expiring keys in stdnet, expiring objects could be the equivalent. Such feature is not available, if you need to expire them you can do it programmatically by deleting them.
If you are using redis as a cache, why do you need the object data mapping of stdnet?
Do you want to expire keys or objects?
Can you share your use case?
jbking commentedon Sep 17, 2014
I thought also the feature before.
A case is making an ephemeral odm object by TTL.
In redis, automatic expiring redis object is supported natively, and it prevents code bugs which related to deleting.
But in stdnet, such object may break system data structure.
By writing above, I got an idea. Let me explain.
How about this? We can do the step 1, but step 2-4 needs stdnet support.
lsbardel commentedon Sep 17, 2014
Sounds interesting but I don't need this feature and I don't have time at the moment.
Happy to assist if anyone decides to implement it.
jbking commentedon Sep 18, 2014
OK, but which branch is better for development?
Branch dev seems broken by ci..
lsbardel commentedon Sep 19, 2014
I would create a new branch from master
jbking commentedon Sep 20, 2014
@lsbardel I've made an issue #81 as another topic