Apparently never reached the list. Forwarding for Jesús...

Jesús wrote
> I'm trying to make a voyage version for CouchDB and I've copied the
> VoyageMongoCache class, but I've been experimenting estrange behavior
> using this class, because of the "equality" of the objects.
> What I have done is to change the class of reversedObject from
> WeakKeyDictionary to WeakIdentityKeyDictionary and the method
> 
> at: anOID put: anObject 
>       self compactIfNeeded.
>       self mutex critical: [ 
>               objects at: anOID put: anObject.
>               reversedObjects at: anObject put: anOID ].
> 
> to:  
> at: anUUID put: anObject 
> 
>       self compactIfNeeded.
>       self mutex critical: [ 
>               reversedObjects at: anObject ifAbsent:[
>                                       objects at: anUUID put: anObject.
>                                       reversedObjects at: anObject 
> put:anUUID] ].
> 
> so now there is only one instance of an object in the cache. May be it
> could be useful for you?





-----
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/Understanding-WeakValueDictionary-tp4755052p4912084.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply via email to