memcached is a small executable program. In the most idiomatic deployment, it listens for TCP connections on port 11211. Clients that connect have access to read and write a single in-memory hashtable with short (up to 250 byte) binary keys and longer (up to 1 megabyte) binary values. Clients use a simple text based protocol to store values in the hashtable by key, or get them by key.
memcached makes no guarantees about how long it will store a key/value pair. If you store a key/value, it may or not be there later when you attempt to retrieve it.