|
|
@ -1,4 +1,4 @@ |
|
|
fast-cache |
|
|
|
|
|
|
|
|
ferrite |
|
|
========== |
|
|
========== |
|
|
|
|
|
|
|
|
A very fast kyoto cabinet powered memcached interface API proxy caching server. |
|
|
A very fast kyoto cabinet powered memcached interface API proxy caching server. |
|
|
@ -8,24 +8,40 @@ you interact with it via a subset of the memcached commands. The main purpose is |
|
|
`http://api.my-domain.com/api/` and then you make memcache get calls like `get/users` or `user/12` or any other |
|
|
`http://api.my-domain.com/api/` and then you make memcache get calls like `get/users` or `user/12` or any other |
|
|
GET only api end point. The result content does not matter at all (which means you could use this to cache HTTP get calls). |
|
|
GET only api end point. The result content does not matter at all (which means you could use this to cache HTTP get calls). |
|
|
|
|
|
|
|
|
The other _very_ important thing about `fast-cache` is that when it gets a cache miss it does now wait around for a response |
|
|
|
|
|
|
|
|
The other _very_ important thing about `ferrite` is that when it gets a cache miss it does now wait around for a response |
|
|
from the proxy server, it will send back an empty string to the client making the request and then queue up the request to |
|
|
from the proxy server, it will send back an empty string to the client making the request and then queue up the request to |
|
|
the proxy server. This means that although you will get back an empty string when you get a cache miss your response times |
|
|
the proxy server. This means that although you will get back an empty string when you get a cache miss your response times |
|
|
from this proxy server will be consistent (which can be very important for high performance applications). |
|
|
from this proxy server will be consistent (which can be very important for high performance applications). |
|
|
|
|
|
|
|
|
|
|
|
## Name |
|
|
|
|
|
The name `ferrite` comes from: [Ferrite Magnet](http://en.wikipedia.org/wiki/Ferrite_(magnet)) |
|
|
|
|
|
|
|
|
## Install |
|
|
## Install |
|
|
### Requirements |
|
|
### Requirements |
|
|
* Kyoto Cabinet Installed |
|
|
* Kyoto Cabinet Installed |
|
|
* libcurl Installed |
|
|
* libcurl Installed |
|
|
|
|
|
|
|
|
```bash |
|
|
```bash |
|
|
git clone git://github.com/brettlangdon/fast-cache.git |
|
|
|
|
|
cd ./fast-cache |
|
|
|
|
|
make |
|
|
|
|
|
# now you have a binary "./fast-cache" available, there is not `make install` yet |
|
|
|
|
|
|
|
|
git clone git://github.com/brettlangdon/ferrite.git |
|
|
|
|
|
cd ./ferrite |
|
|
|
|
|
make release |
|
|
|
|
|
make install |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
## Using |
|
|
## Using |
|
|
|
|
|
## Usage |
|
|
|
|
|
```bash |
|
|
|
|
|
$ ferrite --help |
|
|
|
|
|
Usage: ferrite [-h|--help] [-p|--port <NUM>] [-w|--workers <NUM>] [-u|--url <STRING>] [-c|--cache <STRING>] [-e|--expire <NUM>] |
|
|
|
|
|
-p, --port - which port number to bind too [default: 7000] |
|
|
|
|
|
-w, --workers - how many background workers to spawn [default: 10] |
|
|
|
|
|
-u, --url - which url to proxy requests to [default: http://127.0.0.1:8000] |
|
|
|
|
|
-c, --cache - kyoto cabinet cache to use [default: "*"] |
|
|
|
|
|
-e, --exp - the expiration time in seconds from when a record is cached, 0 to disable [default:3600] |
|
|
|
|
|
-h, --help - display this message |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Memcache Client |
|
|
Just use your favorite memcache client |
|
|
Just use your favorite memcache client |
|
|
```python |
|
|
```python |
|
|
import pymemcache.client |
|
|
import pymemcache.client |
|
|
@ -33,6 +49,7 @@ mc = pymemcache.client.Client([("127.0.0.1", 7000)]) |
|
|
users = mc.get("/all/users") |
|
|
users = mc.get("/all/users") |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Telnet |
|
|
```bash |
|
|
```bash |
|
|
telnet 127.0.0.1 7000 |
|
|
telnet 127.0.0.1 7000 |
|
|
Trying 127.0.0.1... |
|
|
Trying 127.0.0.1... |
|
|
|