Skip to content

psklenar/memcached

 
 

Repository files navigation

memcached

Memcached is High Performance, Distributed Memory Object Cache

Environment variables

The image recognizes the following environment variables that you can set during initialization be passing -e VAR=VALUE to the Docker run command.

Variable name Description
MEMCACHED_DEBUG_MODE Increases verbosity for server and client. Parameter is -vv
MEMCACHED_CACHE_SIZE Sets the size of RAM to use for item storage (in megabytes)
MEMCACHED_CONNECTIONS The max simultaneous connections; default is 1024
MEMCACHED_THREADS Sets number of threads to use to process incoming requests

How to use the container

Pull the image from Docker Hub:

$ sudo docker pull modularitycontainers/memcached

Run the container

docker run -it -p 11211:11211 --name memcached modularitycontainers/memcached

If you would like to debug memcached, use container option -e MEMCACHED_DEBUG_MODE=yes:

docker run -it -p 11211:11211
[-e MEMCACHED_DEBUG_MODE=yes]
--name memcached modularitycontainers/memcached

If you would like to change memcached options, like cache_size, connections or threads, use environment variable -e MEMCACHED_CACHE_SIZE, -e MEMCACHED_CONNECTIONS, -e MEMCACHED_THREADS respectively:

docker run -it -p 11211:11211
[-e MEMCACHED_CACHE_SIZE=<size_in_MB>]
[-e MEMCACHED_CONNECTIONS=<max_simultaneous_connections>]
[-e MEMCACHED_THREADS=<max_concurrent_threads>]
--name memcached modularitycontainers/memcached

A demo

Here is a simple demo how to run memcached

  • Copy systemd service which will take care of memcached container:

    $ sudo cp -av memcached-container.service /usr/lib/systemd/system/
    $ sudo systemctl daemon-reload
  • We can start memcached now:

    $ sudo systemctl start memcached-container
  • You should be able to test memcached by commands (taken from http://www.journaldev.com/16/memcached-telnet-commands-with-example):

    set Test 0 100 10
    JournalDev
    STORED
    get Test
    VALUE Test 0 10
    JournalDev
    END
    replace Test 0 100 4
    Temp
    STORED
    get Test
    VALUE Test 0 4
    Temp
    END
    stats items
    STAT items:1:number 1
    STAT items:1:age 19
    STAT items:1:evicted 0
    STAT items:1:evicted_time 0
    STAT items:1:outofmemory 0
    STAT items:1:tailrepairs 0
    END
    flush_all
    OK
    get Test
    END
    version
    VERSION 1.4.25
    quit

Repository structure

  • Dockerfile - build container image with memcached.
  • openshift-template.yml - Template for OpenShift to memcached.

About

Container for memcached - high-performance, distributed memory object caching system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 37.8%
  • Makefile 21.5%
  • Shell 21.2%
  • Roff 19.5%