Closed GoogleCodeExporter closed 9 years ago
Hi 'GetTypedClient<TPocoType>' is only for complex types i.e. POCO's.
When you call 'Store' from a 'GetTypedClient<TPocoType>()' client, then the key
its stored against is actually 'urn:DTOb:4'. Basically it uses
'IdUtils.CreateUrn<T>()' to determine the key.
So the problem is you're not expiring the same key, i.e. '4' != 'urn:DTOb:4'
Now there is a 'IRedisTypedClient<T>.SetEntry(string key, T value, TimeSpan
expireIn);' where you can specify the key the value is stored against as well
as expire it in a single call.
I can see why its confusing though, although if the method includes the word
'Id' in the name (e.g. GetById) then its just expecting the 'Id' field (i.e.
'4') for all other methods with a 'key' field, its expecting the full key (i.e.
urn:DTOb:4).
Hope this helps.
- Demis
Original comment by demis.be...@gmail.com
on 14 Jul 2010 at 11:22
so when I do SetEntry(), key property should be 4 or urn:DTOb:4 ?
Original comment by dmitrys...@gmail.com
on 15 Jul 2010 at 2:01
Actually in that case, the key can be anything you want it to be. By convention
I would use 'IdUtils.CreateUrn<T>()' to create the key since it is less likely
to collide with other types that share the same Id value and you should then be
able to use other methods (i.e. GetById, etc).
The problem with the current design (that you've highlighted here) is that I've
left some operations on IRedisTypedClient that are not specifically catered for
accessing POCO types.
'IRedisTypedClient<T>.SetEntry(string key, T value, TimeSpan expireIn);'
should really have been:
'IRedisTypedClient<T>.SetEntry(T value, TimeSpan expireIn);'
In which I would've extracted the key automatically for you.
It looks like I'm going to need to go through the 'IRedisTypedClient' interface
and re-factor the methods to make them all a perfect fit.
- Demis
Original comment by demis.be...@gmail.com
on 15 Jul 2010 at 7:35
Original comment by demis.be...@gmail.com
on 28 Aug 2010 at 5:25
Original issue reported on code.google.com by
dmitrys...@gmail.com
on 14 Jul 2010 at 11:07