Initial commit
[memstore.git] / README.md
1 MemStore
2 ========
3
4 _A high-level interface for the memcached and membase servers_
5
6 Written by Kevin M. Rosenberg <kevin@rosenberg.net>
7
8 Prerequisites
9 -------------
10
11 This library incorporates a heavily modified version of `cl-memcached`
12 version 0.4.1. The primary need for the modification is to support the
13 `flags` field supported by the memcached server. The flag field is
14 used to store information required to deserialize the object data from
15 memcached. In addition to adding the `flags` field, the library has
16 been heavily refactored.
17
18 This library also requires Common Lisp libraries of cl-store,
19 flexi-streams, and zlib.
20
21 Overview
22 --------
23
24 Memstore allows efficient storing of simple objects as well as
25 easy storing of complex objects and optional compression.
26
27 When storing an object, if the object is a string then that is
28 directly written to the memcached server. For non-strings, an attempt
29 to made to write the object to a string with `*print-readably*` bound
30 to `t`. If that succeeds, then the string is converted to a vector of
31 octets. If that fails, the `cl-store` is used to serialize that object
32 to a vector of octets.
33
34 Next, optional compression is applied to the octets. First, the
35 `*compression-enabled*` flag is checked to see if compression is
36 enabled. Next, the length of the objects is compared to
37 `*compression-threshold*`. Only objects larger than
38 `*compression-threshold*` will be compressed. For objects that qualify
39 for compression, the size of the compressed object is compared to the
40 length of the uncompressed object to decide if the object is shrunk
41 enough to make the compression worthwhile.
42
43 The `flags` parameter to cl-memcached stores whether cl-store or
44 write-to-string is used to serialize the object and whether
45 compression is applied. `mem-restore` uses those flags to determine
46 how to reconstruct the object.