IronCache - Memcache Interface

As an industry standard, memcached has accumulated an extensive list of supported languages, so it's extremely likely your language of choice is supported.

It's important to note that only the text protocol is supported in IronCache. The binary protocol for memcached is not supported at this time.

Using the memcached interface does not encrypt your credentials during transport.

Table of Contents

Memcache Libraries

Here's a sample list of languages available (with multiple clients libs to choose from for many languages):

  • C
  • C++
  • Perl
  • OCaml
  • Django
  • PHP
  • Lisp
  • Python
  • Erlang
  • Rails
  • Go
  • Ruby
  • Scheme
  • Java
  • Io
  • .NET/C#

You can use any of the memcached clients with IronCache.

Host Information

To connect to IronCache using memcached, use the host below:

Host Port
cache-aws-us-east-1.iron.io 11211

Authentication

Because IronCache requires authentication, clients must set a pseudo-item as soon as they connect. Set the "oauth" key to the following:

{TOKEN} {PROJECT_ID} {CACHE_NAME}

This will not be stored in your cache. Subsequent attempts to set the value of the "oauth" key, however, will be stored in the cache.

Example

The following example should help you get up and running using IronCache with memcached quickly:

Install the Library

The sample uses the memcache-client gem; you'll need to install it before you can use the sample.

Note: The popular Dalli client will not work, as it requires support for the binary memcached protocol, which IronCache does not support at this time.

To install memcache-client, just run the following from your command line:

Command Line
$ gem install memcache-client

Run the Example

iron_cache_memcache.rb
require 'memcache'

# connect
mc = MemCache.new(['cache-aws-us-east-1.iron.io:11211'])

# Tokens can be retrieved from https://hud.iron.io/tokens
token = "Insert your token here"
# Project IDs are listed at https://hud.iron.io
project_id = 'Insert your project_id here'
cache_name = 'Give your cache a unique name'

# authenticate, expiration is 0, don't use marshal serialization
mc.set('oauth', "#{token} #{project_id} #{cache_name}", 0, true)

# store for 5 seconds
mc.set('abc', 123, 5)

# retrieve
p mc.get('abc')

sleep 5

# and it's gone
p mc.get('abc')