My favorites | Sign in
Project Logo
                
People details
Project owners:
  ryan.daum
Project committers:
jhorman, tspurway, gkorland

jmemcached

This is a Java implementation of the daemon (server) side of the memcached protocol.

Memcache is a network accessible key/value storage system, often used as a distributed cache.

Jmemcached is functionally equivalent in most respects to (native code) memcached, but is written in pure Java, and is thus suitable for:

What would I use it for?

A distributed client/server style cache. Some people use memcached to reduce load on their database. Some people just use it to share data across a cluster. It's simple and common. It's a good general purpose network available cache to compliment any network available service.

Tell me more details...

Ok.

How do I use it?

There are two ways; programmatically (embedded inside your application) or using the command-line (CLI) interface.

For programmatic example, here's a snippet from the source for the main class for the CLI:

        // create daemon and start it
        MemCacheDaemon daemon = new MemCacheDaemon();
        LRUCacheStorageDelegate cacheStorage = new LRUCacheStorageDelegate(max_size, max_bytes, 1024000);
        daemon.setCache(new Cache(cacheStorage));
        daemon.setAddr(addr);
        daemon.setIdleTime(idle);
        daemon.setPort(port);
        daemon.setVerbose(verbose);
        daemon.start();

To use ''jmemcached'' from the command line, just run Java against the cli "-with-dependendencies" JAR.

The CLI accepts the following options:

 -b,--binary              binary protocol mode
 -bs,--block-size <arg>   block size (in bytes) for external memory mapped
                          file allocator.  default is 8 bytes
 -c,--ceiling <arg>       ceiling memory to use; in bytes, specify K, kb,
                          M, GB for larger units
 -f,--mapped-file <arg>   use external (from JVM) heap through a memory
                          mapped file
 -h,--help                print this help screen
 -i,--idle <arg>          disconnect after idle <x> seconds
 -l,--listen <arg>        Address to listen on
 -m,--memory <arg>        max memory to use; in bytes, specify K, kb, M,
                          GB for larger units
 -p,--port <arg>          port to listen on
 -s,--size <arg>          max items
 -v                       verbose (show commands)
 -V                       Show version number

How can I get it?

You can retrieve the compiled JARs from the Maven 2 repository: http://thimbleware.com/maven/com/thimbleware/

Debian/Ubuntu packages are also available in the repository.

To make use of jmemcached in your project, the easiest way is to use Maven 2.

To do this using Maven, add the ThimbleWare repository:

    <repositories>
        <repository>
            <id>thimbleware.repo</id>
            <url>http://thimbleware.com/maven</url>
        </repository>
    </repositories>

And then add the dependency:

    <dependency>
        <groupId>com.thimbleware.jmemcached</groupId>
        <artifactId>jmemcached-core</artifactId>
        <version>0.8</version>
    </dependency>

What's next?

Missing features (when compared against the native C version):

Thanks to...

YourKit is kindly supporting open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit .NET Profiler.









Hosted by Google Code