I think you should be able to (this is not tested, just off the top of
my head):

<cfset memcachePolicy =
createObject("java","com.google.appengine.api.memcache.MemcacheService
$SetPolicy")>

then, when you put your cache value:

<cfset
cache.put(key,value,expires,memcachePolicy.ADD_ONLY_IF_NOT_PRESENT)>

this would be how you would do it on a put-by-put basis.

The setPolicy class is a nested class of MemcacheService, so you use
the '$' instead of the '.'

I should test this so I don't send you down the wrong trail.

Ed.

On Jun 2, 6:37 pm, Adam Knott <[email protected]> wrote:
> The following code is working as expected. The value gets set in
> memcache and expires after 10 seconds.
>
> <cfset cache = createObject( "java",
> "com.google.appengine.api.memcache.MemcacheServiceFactory").getMemcacheService()>
> <cfset key="test">
> <cfset value=now()>
> <cfset expires = createObject( "java",
> "com.google.appengine.api.memcache.Expiration").byDeltaSeconds(10)>
> <cfset cache.put(key,value,expires)>
> <cfset out = cache.get(key)>
> <cfoutput>Value : #out#</cfoutput>
>
> I would like to change the SetPolicy on the cache to
> "ADD_ONLY_IF_NOT_PRESENT", but I am new to java and can't seem to
> figure out the syntax to do this.
>
> Any Suggestions?
>
> Thanks,
> Adam

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to