MySQL :: MySQL 5.7 Reference Manual :: Basic memcached Operations

MySQL :: MySQL 5.7 Reference Manual :: Basic memcached Operations Contact MySQL  |  Login  |  Register The world's most popular open source database MySQL.com Downloads Documentation Developer Zone Developer Zone Downloads MySQL.com Documentation MySQL Server MySQL Enterprise Workbench Router Utilities/Fabric MySQL NDB Cluster Connectors More MySQL.com Downloads Developer Zone Section Menu:   Documentation Home MySQL 5.7 Reference Manual Preface and Legal Notices General Information Installing and Upgrading MySQL Using MySQL as a Document Store Tutorial MySQL Programs MySQL Server Administration Security Backup and Recovery Optimization Language Structure Globalization Data Types Functions and Operators SQL Statement Syntax The InnoDB Storage Engine Alternative Storage Engines High Availability and Scalability Using ZFS Replication Using ZFS for File System Replication Configuring MySQL for ZFS Replication Handling MySQL Recovery with ZFS Using MySQL with memcached Installing memcached Using memcached memcached Command-Line Options memcached Deployment Using Namespaces Data Expiry memcached Hashing/Distribution Types Using memcached and DTrace Memory Allocation within memcached memcached Thread Support memcached Logs Developing a memcached Application Basic memcached Operations Using memcached as a MySQL Caching Layer Using libmemcached with C and C++ Using MySQL and memcached with Perl Using MySQL and memcached with Python Using MySQL and memcached with PHP Using MySQL and memcached with Ruby Using MySQL and memcached with Java Using the memcached TCP Text Protocol Getting memcached Statistics memcached General Statistics memcached Slabs Statistics memcached Item Statistics memcached Size Statistics memcached Detail Statistics Using memcached-tool memcached FAQ Replication MySQL NDB Cluster 7.5 Partitioning Stored Programs and Views INFORMATION_SCHEMA Tables MySQL Performance Schema MySQL sys Schema Connectors and APIs Extending MySQL MySQL Enterprise Edition MySQL Workbench MySQL 5.7 Frequently Asked Questions Errors, Error Codes, and Common Problems Restrictions and Limits Indexes MySQL Glossary Related Documentation MySQL 5.7 Release Notes Download this Manual PDF (US Ltr) - 35.7Mb PDF (A4) - 35.7Mb PDF (RPM) - 34.7Mb EPUB - 8.7Mb HTML Download (TGZ) - 8.5Mb HTML Download (Zip) - 8.5Mb HTML Download (RPM) - 7.3Mb Eclipse Doc Plugin (TGZ) - 9.3Mb Eclipse Doc Plugin (Zip) - 11.5Mb Man Pages (TGZ) - 203.5Kb Man Pages (Zip) - 308.9Kb Info (Gzip) - 3.3Mb Info (Zip) - 3.3Mb Excerpts from this Manual MySQL Backup and Recovery MySQL Globalization MySQL Information Schema MySQL Installation Guide MySQL and Linux/Unix MySQL and OS X MySQL Partitioning MySQL Performance Schema MySQL Replication Using the MySQL Yum Repository MySQL Restrictions and Limitations Security in MySQL MySQL and Solaris Building MySQL from Source Starting and Stopping MySQL MySQL Tutorial MySQL and Windows MySQL Cluster NDB 7.5 version 5.7 8.0 5.6 5.5 5.6  Japanese MySQL 5.7 Reference Manual  /  ...  /  High Availability and Scalability  /  Using MySQL with memcached  /  Developing a memcached Application  /  Basic memcached Operations Basic memcached Operations The interface to memcached supports the following methods for storing and retrieving information in the cache, and these are consistent across all the different APIs, although the language specific mechanics might be different: get(key): Retrieves information from the cache. Returns the value associated with the key if the specified key exists. Returns NULL, nil, undefined, or the closest equivalent in the corresponding language, if the specified key does not exist. set(key, value [, expiry]): Sets the item associated with a key in the cache to the specified value. This either updates an existing item if the key already exists, or adds a new key/value pair if the key doesn't exist. If the expiry time is specified, then the item expires (and is deleted) when the expiry time is reached. The time is specified in seconds, and is taken as a relative time if the value is less than 30 days (30*24*60*60), or an absolute time (epoch) if larger than this value. add(key, value [, expiry]): Adds the key and associated value to the cache, if the specified key does not already exist. replace(key, value [, expiry]): Replaces the item associated with the specified key, only if the key already exists. The new value is given by the value parameter. delete(key [, time]): Deletes the key and its associated item from the cache. If you supply a time, then adding another item with the specified key is blocked for the specified period. incr(key , value): Increments the item associated with the key by the specified value. decr(key , value): Decrements the item associated with the key by the specified value. flush_all: Invalidates (or expires) all the current items in the cache. Technically they still exist (they are not deleted), but they are silently destroyed the next time you try to ac