Welcome to JCache

Copyright © 2013-2015 Jim Rosenblum

Version: v0.9.5

Authors: Jim Rosenblum (jrosenblum@carelogistics.com).


Erlang, Distributable, In-Memory Cache

JSON-Query; Consistency Assist; and Simple, TCP Interoperability Protocol


Cache Functions (jc)

Consistency Supported 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)

{jc_node_events, {nodedown, DownedNode, [ActiveNodes],[ConfiguredNodes]}}

{jc_node_events, {nodeup, UppedNode, [ActiveNodes],[ConfiguredNodes]}}

Indexing Functions (jc_store)

Bridge Functions (jc_bridge)

{From, {Fn, P1, P2,...}}

for each paramater, as in

jc_bridge ! {Pid, {put, Map, Key, Value}}

{From, {node_topic_sub}} -> ok | {error, badarg}, client will recieve:

{jc_node_events, {nodedown, DownedNode, [ActiveNodes],[ConfiguredNodes]}}


{jc_node_events, {nodeup, UppedNode, [ActiveNodes],[ConfiguredNodes]}}

{From, {node_topic_unsub}} -> ok.

Interoperability: String protocol

This is a binary-encoded, string protocol used to provide socket-based interoperability with JC.

All messages to the cache system 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>> = 

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}">> = 

The CLOSE command closes the socket, ending the session

M = <<"{close}">>

 Size is 7 so the CLOSE message is:

COMMAND messages are string versions of the tuple-messages which jc_bridge uses only 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}\"}")

client:send("{get, evs, \"1\"}"),


Application Modules

Build Instructions

[root@db01] git clone https://github.com/jr0senblum/jc.git


[root@dbo1] ./rebar3 edoc

Generated by EDoc, Sep 7 2016, 09:32:13.