JC

##Erlang, Distributable, In-Memory Cache

Pub/Sub; JSON-Query; Consistency Assist; and Simple, TCP Interoperability Protocol.

Build Status hex.pm version

###Features

###Cache Functions (jc)

Consistency Support Functions (jc_s)

Identical to the Create and Evict family of functions of the jc module (see above), except:

###Eviction Manager Functions (jc_eviction_manager)

###Pub/Sub Functions (jc_psub)

###Indexing Functions (jc_store)

###Interoperability: Bridge (jc_bridge)

Interoperability: Socket Protocol

Binary-encoded, string protocol used to provide socket-based interoperability with JC.

All messages to JC are string representations of a tuple. All messages form the caching system to the client are JSON

The protocol defines three message types: CONNECT, CLOSE and COMMAND all of which are binary strings consisting of an 8-byte size followed by the actual command messages.

Responses are also binary strings with an 8-byte size prefix.

The CONNECT command initiates a session,

M = <<"{connect,{version,\"1.0\"}}">>
Size is 25, so the CONNECT message is:
<<25:8, M/binary>> =
<<25,40,58,99,111,110,110,101,99,116,32,123,58,118,101,
114,115,105,111,110,32,49,46,48,125,41>>

The server will respond to a CONNECT command with either an error or the encoded version of {"version":" "1.0"}

<<15:8, <<"{\"version\":\"1.0\"}">> =
<<15,123,34,118,101,114,115,105,111,110,34,58,49,46,48,125>>

The CLOSE command closes the socket, ending the session

M = <<"{close}">>
Size is 7 so the CLOSE message is:
<<7,123,99,108,111,115,101,125>>

COMMAND messages are string versions of the tuple-messages, which jc_bridge uses, without the self() parameter. For example

{self(), {put, Map, Key, Value}} becomes
{put, Map, Key, Value}

The return will be an encoded version of a JSON string. A client session might look as follows:

client:send("{put, evs, \"1\", \"{\\\"value:\\\":true}\"}")
<<"{\"ok\":\"1\"}">>
client:send("{get, evs, 1}"),
<<"{\"ok\":"{\\\"value\\\":true}\"}">>

###Configuration

###Application Modules

###Build Instructions

###Documentation

[root@dbo1] ./rebar3 edoc

Component and Sequence Diagrams

Components

Sequence Diagrams