Memcache-Tag Introduction - Memcached is a high-performance distributed memory object caching system, which can be used to store various types of data, including images, videos, documents and database retrieval results. In the past, you can only use "delete" command to delete one record. When delete several records, you need to execute "delete" command several times. To simplify the batch delete operation, and reduce the network load, we developed tag function.
- Tag function can delete a number of keys at one time. In design, we considerate it's need to find and delete tag efficient, so use HASH store tags, the time complexity of O(1). Initially, we use linked list store the corresponding keys sequence of one tag, when take into account save memory and avoid duplication of keys, then use the binary tree "splaytree" storage the key sequence. Splaytree not only can remove duplicate keys, but also rotate the visited node near the root to make for more efficient, its time complexity is no more than O(logn).
- How to Use? You just need start the memcached program on the server-side (also can run on several servers with different port). On the client-side, you need to install php extension module with user "root".
- We modified code based on the memcached 1.2.4 and php module 2.2.2. Both "diff" files and source code can be downloaded here.
|