On the other note, proposed JSR107 java cache api, expresses that a method
boolean containsKey(K key) On 26 Feb 2012, at 20:30, Michael André Pearce wrote: > I assume you are talking about remove / update methods? > > If not…. > is it re containsKey method moved from DirectMemoryCache to CacheService to > remove DirectMemoryCache class, this is quite normal that you can check a key > exists in a cahce. Also see map implementation interface which essentially > most caches are glorified maps, expose a method containsKey. > > > > On 26 Feb 2012, at 20:19, Michael André Pearce wrote: > >> This is within a lock. Thus it cannot be altered my another update or delete >> until it is completed. >> >> This follows the very similar style used in ehcache on memory store, this >> ensures behaviour of trying to update or remove an object which didnt exists >> so that the user knows if on removal or update of a key if an element >> existed already. >> >> >> On 26 Feb 2012, at 19:58, Simone Tripodi (Commented) (JIRA) wrote: >> >>> >>> [ >>> https://issues.apache.org/jira/browse/DIRECTMEMORY-60?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216820#comment-13216820 >>> ] >>> >>> Simone Tripodi commented on DIRECTMEMORY-60: >>> -------------------------------------------- >>> >>> I am a little reluctant on adding checks to verify a key exists in a cache, >>> it would induce users on applying the following pattern: >>> >>> {code} >>> if ( cacheService.containsKey( "key" ) ) >>> { >>> // in the meanwhile someone else drops "key"... >>> >>> Object retrieved = cacheService.retrieve( "key" ); >>> } >>> {code} >>> >>> that is the reason why other cache solutions, such as memcached, don't >>> expose such APIs. Just retrieve the value and check something was cached. >>> >>>> EHCache Integration >>>> ------------------- >>>> >>>> Key: DIRECTMEMORY-60 >>>> URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-60 >>>> Project: Apache DirectMemory >>>> Issue Type: New Feature >>>> Reporter: Michael André Pearce >>>> Priority: Minor >>>> Labels: EHCache, Integration >>>> Attachments: DIRECTMEMORY-60-directmemory-cache.patch, >>>> DIRECTMEMORY-60-ehcache.patch, DIRECTMEMORY-60.tidy.zip, >>>> DIRECTMEMORY-60.zip, directmemory-ehcache.zip >>>> >>>> >>>> Integrate DirectMemory to be used with EHCache. >>> >>> -- >>> This message is automatically generated by JIRA. >>> If you think it was sent incorrectly, please contact your JIRA >>> administrators: >>> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa >>> For more information on JIRA, see: http://www.atlassian.com/software/jira >>> >>> >> >
