This project has retired. For details please refer to its Attic page.
Memcache Cache
Polygene™
Introduction
Tutorials
Javadoc
Samples
Core
Libraries
Extensions
Tools
Glossary 

Memcache Cache

code

docs

tests

EntityStore cache backed by a Memcache server like Memcached.

Memcached is an in-memory key-value store for small chunks of arbitrary data. By default, entities serialized state must not exceed 1MB.

Other implementations such as MemCachier have different peculiarities, see their documentation.

Table 64. Artifact

Group IDArtifact IDVersion

org.apache.polygene.extensions

org.apache.polygene.extension.cache-memcache

3.0.0


Not all EntityStore implementations use the Cache extension, so check the implementation details of the EntityStore whether the cache extension can bring any benefits or not.

Assembly

Assembly is done using the MemcacheAssembler:

public void assemble( ModuleAssembly module )
    throws AssemblyException
{
  [...snip...]

    new MemcacheAssembler().
        visibleIn( Visibility.module ).
        withConfig( confModule, Visibility.layer ).
        assemble( module );
          [...snip...]

}

Configuration

Here are the configuration properties for the Memcache EntityStore Cache:

public interface MemcacheConfiguration
{
    /**
     * Cached items expiration in seconds.
     * Defaulted to 3600 seconds, one hour.
     * @return Cached items expiration configuration property
     */
    @Optional
    Property<Integer> expiration();

    /**
     * Memcached server addresses space separated.
     * Eg. {@literal "server1:11211 server2:11211"}.
     * Defaulted to {@literal "127.0.0.1:11211"}.
     * @return Memcached server addresses configuration property
     */
    @Optional
    Property<String> addresses();

    /**
     * Memcache Protocol.
     * Can be {@literal text} or {@literal binary}
     * Defaulted to {@literal text}.
     * @return Memcache Protocol configuration property
     */
    @Optional
    Property<String> protocol();

    /**
     * Username.
     * Authentication happens only if set.
     * @return Username configuration property
     */
    @Optional
    Property<String> username();

    /**
     * Password.
     * @return Password configuration property
     */
    @Optional
    Property<String> password();

    /**
     * SASL authentication mechanism.
     * Defaulted to PLAIN.
     * @return Authentication mechanism configuration property
     */
    @Optional
    Property<String> authMechanism();
}

As you can see both ASCII and binary flavours of the Memcache protocol are supported as well as SASL authentication.