Gets a handle to the cache service. Although there is only one actual
cache, an application may make as many MemcacheService instances
as it finds convenient.
If using multiple instances, note that the error handler established with
MemcacheService#setErrorHandler(ErrorHandler) is specific to each
instance.
Gets a handle to the cache service, forcing use of specific namespace.
The method returns MemcacheService
similar to the one returned by
MemcacheServiceFactory#getMemcacheService()
but it will use specified namespace for all operations.
if not null forces the use of namespace
for all operations in MemcacheService . If namespace is
null - created MemcacheService will use current namespace
provided by com.google.appengine.api.NamespaceManager#get().
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eMemcacheServiceFactory\u003c/code\u003e is the mechanism through which users obtain a handle to interact with the \u003ccode\u003eMemcacheService\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve either synchronous or asynchronous versions of the \u003ccode\u003eMemcacheService\u003c/code\u003e using the \u003ccode\u003egetMemcacheService()\u003c/code\u003e and \u003ccode\u003egetAsyncMemcacheService()\u003c/code\u003e methods respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMemcacheService\u003c/code\u003e can be instantiated to operate within a specific namespace using a \u003ccode\u003eString\u003c/code\u003e parameter, or using the default namespace manager if a parameter isn't provided.\u003c/p\u003e\n"],["\u003cp\u003eMultiple \u003ccode\u003eMemcacheService\u003c/code\u003e instances can be created within an application, but the error handler is specific to each instance.\u003c/p\u003e\n"]]],[],null,["# Class MemcacheServiceFactory (2.0.0)\n\n public class MemcacheServiceFactory\n\nThe factory by which users acquire a handle to the MemcacheService. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e MemcacheServiceFactory \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### getAsyncMemcacheService()\n\n public static AsyncMemcacheService getAsyncMemcacheService()\n\nSimilar to [#getMemcacheService()](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheServiceFactory#com_google_appengine_api_memcache_MemcacheServiceFactory_getMemcacheService__) but returns a handle to an\nasynchronous version of the cache service.\n\n### getAsyncMemcacheService(String namespace)\n\n public static AsyncMemcacheService getAsyncMemcacheService(String namespace)\n\nSimilar to [#getMemcacheService(String)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheServiceFactory#com_google_appengine_api_memcache_MemcacheServiceFactory_getMemcacheService_java_lang_String_) but returns a handle to an\nasynchronous version of the cache service.\n\n### getMemcacheService()\n\n public static MemcacheService getMemcacheService()\n\nGets a handle to the cache service. Although there is only one actual\ncache, an application may make as many `MemcacheService` instances\nas it finds convenient.\n\n\nIf using multiple instances, note that the error handler established with\nMemcacheService#setErrorHandler(ErrorHandler) is specific to each\ninstance.\n\nAll operations in the `MemcacheService` will use the current\nnamespace provided by\n[com.google.appengine.api.NamespaceManager#get()](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.NamespaceManager#com_google_appengine_api_NamespaceManager_get__).\n\n### getMemcacheService(String namespace)\n\n public static MemcacheService getMemcacheService(String namespace)\n\nGets a handle to the cache service, forcing use of specific namespace.\nThe method returns `MemcacheService`\nsimilar to the one returned by\n[MemcacheServiceFactory#getMemcacheService()](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheServiceFactory#com_google_appengine_api_memcache_MemcacheServiceFactory_getMemcacheService__)\nbut it will use specified `namespace` for all operations."]]