Experimental memcached client implemented in Ada
Go to file
R. Tyler Croy 36e6444f20
Try again to coerce Travis into installing packages
2016-01-09 12:04:46 -08:00
integrationtests Rename the client/ directory to the src/ directory 2011-03-27 10:25:49 -07:00
src Re-namespace to Memcache.Client 2011-03-27 10:32:56 -07:00
tests Rename unit tests and adjust according with the namespace change from Memcache -> Memcache.Client 2011-04-04 23:14:25 -07:00
.gitignore Ignore vim droppings 2016-01-09 11:28:47 -08:00
.travis.yml Try again to coerce Travis into installing packages 2016-01-09 12:04:46 -08:00
COPYING Change the license to the LGPL 2016-01-09 11:34:58 -08:00
LICENSE Change the license to the LGPL 2016-01-09 11:34:58 -08:00
Makefile Shuffle the Makefile up such that the `lib` target is the default 2011-03-27 10:26:19 -07:00
README.adoc Move readme around to trigger travis 2016-01-09 11:40:31 -08:00
memcache.gpr Rename the client/ directory to the src/ directory 2011-03-27 10:25:49 -07:00
memcache.py Add python memcache client for my own quick reference 2010-12-04 15:46:33 -08:00
memcachetest.gpr Update the .gpr files to build a proper shared library 2011-03-21 22:14:01 -07:00
memcachetestxml.gpr Update the .gpr files to build a proper shared library 2011-03-21 22:14:01 -07:00
protocol.txt Add the memcached protocol document 2010-11-13 14:48:49 -08:00

README.adoc

<html lang="en"> <head> </head>

memcache-ada

memcache-ada is a work in progress, implementing the Memcached text-protocol for communicating with a Memcached server from an Ada program.

Status

memcache-ada is currently in a very usable state for basic cache usage, that said, the library is not very well documented just yet. The source code in the client/ directory is fairly straight-forward, so I suggest consulting that if you have any questions

Implemented Calls

+----------------------------------------------------------+
|    Name      |  Status  |           Notes                |
+----------------------------------------------------------+
| get          |  y       |                                |
| gets         |  n       |                                |
+--------------+-------------------------------------------+
| set          |  y       |                                |
| add          |  y       |                                |
| replace      |  y       |                                |
| append       |  y       |                                |
| prepend      |  y       |                                |
| cas          |  n       |                                |
+--------------+-------------------------------------------+
| delete       |  y       |                                |
+--------------+-------------------------------------------+
| incr         |  y       |                                |
| decr         |  y       |                                |
+--------------+-------------------------------------------+
| stats        |  y       |                                |
| stats (args) |  n       |                                |
| flush_all    |  y*      | delayed flush not supported    |
| version      |  y       |                                |
| verbosity    |  n       | no plans to support            |
| quit         |  n       | no plans to support            |
+--------------+-------------------------------------------+

Warnings

The Memcache.Connection object cannot be shared between multiple tasks concurrently! It is currently designed only for use within a single task at a time and offers zero protection between tasks. It is better to use multiple objects across multiple tasks if necessary (I have some ideas regarding connection pooling and sharing between tasks but the library is not quite there yet).

Examples

Creating a connection:

procedure Sample is
    C : Memcache.Connection := Memcache.Create (Host => "127.0.0.1",
                                    Port => 11211);
begin
    C.Connect;
    -- Do stuff
    C.Disconnect;
end Sample;

Setting a value:

procedure Sample is
    C : Memcache.Connection := Memcache.Create (Host => "127.0.0.1",
                                    Port => 11211);
begin
    C.Connect;
    C.Set ("SomeKey", "This sentence is so important, I need to cache it for five minutes", 300);
    C.Disconnect;
end Sample;

Getting a value:

procedure Sample is
    package SU renames Ada.Strings.Unbounded;
    C : Memcache.Connection := Memcache.Create (Host => "127.0.0.1",
                                    Port => 11211);
begin
    C.Connect;
    declare
        Info : Memcache.Response := C.Get ("SomeKey");
    begin
        Ada.Text_IO.Put_Line ("`SomeKey` => " & SU.To_String(Info.Data));
    end;
    C.Disconnect;
end Sample;
</html>