I was expecting the following AppEngine code:
MemcacheService memcache = MemcacheServiceFactory.getMemcacheService();
memcache.put(\"Foo\", \"Bar\", Expiration.o
Wow! This was obscure, but I figure it out:
Taking a look at the source for the doPut()-method in AsyncMemcacheServiceImpl.java, line 505 reads:
itemBuilder.setExpirationTime(expires == null ? 0 : expires.getSecondsValue());
And Expiration.getSecondsValue() contains the following line:
return (int) (getMillisecondsValue() / 1000);
In other words: An expiration value of "0" is equivalent to no expiration (same as null), and the expiration time is converted to seconds, by dividing by 1000.
So, if I set an expiration of 1ms, it gets turned into 0 seconds (rounded down when divided by 1000), which is equivalent to no expiration... Blah!!!
So, the answer is: Expiration.onDate(new Date(1000))
should expire immediately, unless the memcache server is still living in the 60's... :) Tried it. Works. Done...
(These tests were done on the DevServer. I'm hoping that the production server will behave the same.)