Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / memcache / stdimpl / GCacheFactory.java
blob7636d2e8ae3f68cbd7f1fa3272348758f17055ad
1 // Copyright 2009 Google Inc. All Rights Reserved.
3 package com.google.appengine.api.memcache.stdimpl;
5 import java.util.Map;
7 import javax.cache.Cache;
8 import javax.cache.CacheFactory;
10 /**
11 * JCache CacheFactory implementation using Memcache.
14 public class GCacheFactory implements CacheFactory {
16 /**
17 * Property key for expiration time in seconds set for all put operations as
18 * an Integer.
20 public static final int EXPIRATION_DELTA = 0;
22 /**
23 * Property key for expiration time in milliseconds set for all put
24 * operations as an Integer.
26 public static final int EXPIRATION_DELTA_MILLIS = 1;
28 /**
29 * Property key for absolute expiration time for all put operations as a
30 * {@link Date}.
32 public static final int EXPIRATION = 2;
34 /**
35 * Property key for put operation policy as a
36 * {@link com.google.appengine.api.memcache.MemcacheService.SetPolicy}.
37 * Defaults to {@link SetPolicy.SET_ALWAYS} if not specified.
39 public static final int SET_POLICY = 3;
41 /**
42 * Property key for memcache service to use as a
43 * {@link com.google.appengine.api.memcache.MemcacheService}. Defaults to
44 * that provided by {@link MemcacheServiceFactory.getMemcacheService} if not
45 * specified.
47 public static final int MEMCACHE_SERVICE = 4;
49 /**
50 * Property key for defining a non-default namespace. This has the
51 * same effect setting a namespace using {@link
52 * com.google.appengine.api.memcache.MemcacheServiceFactory#getMemcacheService(String)}.
53 * This property is ignored if MEMCACHE_SERVICE property specified.
55 public static final int NAMESPACE = 5;
57 /**
58 * Creates a cache instance using the memcache service.
59 * @param map A map of properties.
60 * @return a cache.
62 public Cache createCache(Map map) {
63 return new GCache(map);