# Class MemcacheServiceFactory (5.0.3)

    public class MemcacheServiceFactory

The factory by which users acquire a handle to the MemcacheService.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> MemcacheServiceFactory

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### getAsyncMemcacheService()

    public static AsyncMemcacheService getAsyncMemcacheService()

Similar to [#getMemcacheService()](https://docs.cloud.google.com/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
asynchronous version of the cache service.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.AsyncMemcacheService` |   |

### getAsyncMemcacheService(String namespace)

    public static AsyncMemcacheService getAsyncMemcacheService(String namespace)

Similar to [#getMemcacheService(String)](https://docs.cloud.google.com/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
asynchronous version of the cache service.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `namespace` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.AsyncMemcacheService` |   |

### getMemcacheService()

    public static MemcacheService getMemcacheService()

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.

All operations in the `MemcacheService` will use the current
namespace provided by
[com.google.appengine.api.NamespaceManager#get()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.NamespaceManager#com_google_appengine_api_NamespaceManager_get__).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService` | a new `MemcacheService` instance. |

### getMemcacheService(String namespace)

    public static MemcacheService getMemcacheService(String namespace)

Gets a handle to the cache service, forcing use of specific namespace.
The method returns `MemcacheService`
similar to the one returned by
[MemcacheServiceFactory#getMemcacheService()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheServiceFactory#com_google_appengine_api_memcache_MemcacheServiceFactory_getMemcacheService__)
but it will use specified `namespace` for all operations.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `namespace` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` 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()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.NamespaceManager#com_google_appengine_api_NamespaceManager_get__). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService` | a new `MemcacheService` instance. |