Skip to content

Getting Started with using Memcached

opuneet edited this page May 27, 2014 · 2 revisions

Dyno uses the spy memcached client underneath when talking to a dynomite-memcached setup.

Dyno client setup

Here is how you can init the dyno client

  1. First get the dyno client
dependencies {
        compile "com.netflix.dyno:dyno-memcache:{LATEST VERSION}"
}
  1. Build and init the client
DynoMCacheClient dynoClient = DynoMCacheClient.Builder.withName({YOUR APP NAME})
			                      .withDynomiteClusterName({DYNOMITE CLUSTER NAME})
			                      .build())

Dyno Memcached reads

String value = client.<String>get("foo");

Dyno Memcached writes

// Set with indefinite expiration
client.<String>set("foo", "bar");

// Set with expiration in 1 hr
client.<String>set("foo", "bar", 3600);

Dyno Memcached deletes

// Set with indefinite expiration
client.<String>set("foo", "bar");

// Set with expiration in 1 hr
client.delete("foo");