Blob Blame History Raw
# memcached

[**Package DB** (owner)](https://admin.fedoraproject.org/pkgdb/package/modules/memcached/) |
[**F26 modulemd** (source)](http://pkgs.fedoraproject.org/cgit/modules/memcached.git/tree/memcached.yaml?h=f26) |
[**PDC** (result)](https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants/?active=True&variant_name=memcached)

  
   memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
  
## Current state

| State | Description |
|-------|-------------|
| ✓ YES | **Build passes** in the infra (all build deps are ok) |
| ✓ YES | **Installs** on the Base Runtime (all runtime deps are ok) |
| ✓ YES | **No bootstrap** - uses only proper modules |
| ✓ YES | General **tests are in dist-git** |
| ✓ YES | General **tests pass** |
| ✗ NO  | Meets the **Fedora Module Packaging Guidelines** |

## Summary

- See [**README**](https://github.com/container-images/memcached) on github for more details.
- See [**hub.docker**](https://hub.docker.com/r/modularitycontainers/memcached/) for Dockerimage.
- Dockerfile - build container image with memcached.
- openshift-template.yml - Template for OpenShift to memcached.


## How to use the container over standard 11211 port

Command for running memcached docker container:

```bash
docker run -it -e CACHE_SIZE=128 \
    -p 11211:11211
```

If you would like to increase a CACHE_SIZE use environment variable -e CACHE_SIZE:
```bash
docker run -it -e CACHE_SIZE=128 \
    -p 11211:11211
```

## How to run memcached as standalone container

Copy memcached-container.service to ```/usr/lib/systemd/user/``` directory
```bash
sudo cp memcached-container.service /usr/lib/systemd/user/
systemctl --user daemon-reload
```

Command for running memcached as standalone container:
```bash
systemctl start --user memcached-container
```

## How to stop memcached as standalone container
Command for stopping memcached as standalone container:
```bash
systemctl stop --user memcached-container
```
## How to test the memcached

Commands for testing memcached docker container:

To store data in memcached server with telnet:
```bash
set KEY META_DATA EXPIRY_TIME LENGTH_IN_BYTES
```

To get data
```bash
get KEY
```

To overwrite existing key
```bash
replace KEY META_DATA EXPIRE_TIME LENGTH_IN_BYTES
```

To delete key
```bash
delete KEY
```

To get the server statistics
```bash
stats
stats items
stats slabs

```

To clear the metadata statistics
```bash
flush all
```

Memcached Server Telnet Example (taken from http://www.journaldev.com/16/memcached-telnet-commands-with-example)
```bash
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
```