No project is complete without a database. We are used to seeing in it a repository of a multitude of related objects, with a multitude of conditions. This is undoubtedly very convenient, but due to various circumstances, in a loaded system, it is often necessary to resort to other methods, since The number of samples and transactions is limited to modern hardware, and it’s not easy to distribute to multiple servers. In some cases, you can use replication, but this is not a panacea at the moment.
Non-relational storage is a distributed I / O system that allows you to store "key -> value" pairs. Such databases are of two types: stable and unstable. Stable (for example, MemcacheDB, TDB, Hypertable) write data to disk and use a transactional model. Unstable (for example, Memcached) - they store keys in memory only for a while (and do not claim safety).
Unstable is convenient to use for caching and reducing the load on stable ones. There are a lot of final implementations, but I chose Memcached and MemcacheDB. Contrary to the first impression, Memcached can do a lot, much more than writing / reading the result, for which it is used in most cases. Realizing this, I was faced with a shortage of ready-made tools needed for effective industrial development of solutions using such techniques. This is how IMemcacheClient (Improved Memcache Client) was born, it allows you to forget about the implementation and use the interfaces.
Key features and benefits:
- Ability to set a common prefix for all keys (namespace).
- In addition to the basic features (get / set / append / prepend / increment / decrement), the modular architecture includes:
1. Object Lock - implements mutex (mutual exclusion, blocking).
Most often used to prevent the simultaneous execution of two tasks.
2. Entry object - implements tag storage with the possibility of tagging.
Unfortunately, at the moment, tagging is not implemented natively, but through additional keys and named invalidation.
3. Object Queue - implements a distributed queue with support for multiple views (multi-views).
A process group can simultaneously write to a queue, and another group can read it. At the same time, it is guaranteed that 1 message will not be received more than once within one View.
')
4. SharedInteger object - implements an atomic shared Integer with increment / decrement support.
Convenient to use for counters, anti-flood.
5. Object SharedObject - implements an atomic shared object.
You can efficiently store small arrays that are infrequently updated.
- The distribution includes the implementation of the MapReduce framework based on the Queue module. Examples are attached.
- The ability to use the functionality with Memcached, and MemcacheDB.
The project is very young, but it was written not to be, but to solve urgent problems, with which it copes remarkably well.
I am pleased to consider any ideas, suggestions and bug reports, the development is proceeding at a rapid pace.
LGPL.
Web:
code.google.com/p/imemcacheclient-phpWritten by kak.serpom.po.yaitsam@gmail.com