Module jc

This module wraps the mnesia-interacting, lower-level functions implemented in jc_store to provide a public, DIRTY, set of opperations.

Copyright © (C) 2011 - 2015, Jim Rosenblum

Version: Sep 7 2016 09:32:12

Authors: Jim Rosenblum.

Description

This module wraps the mnesia-interacting, lower-level functions implemented in jc_store to provide a public, DIRTY, set of opperations. jc_s provides functions that take a sequence parameter to better support serilization (consistency) without. resorting to transactions.

JC can be called directly by Erlang clients; or, Java node -> JInterface -> jc_bridge -> jc; or, Application -> TPC/IP -> jc_protocol -> jc

Data Types

key()

key() = any()

map_name()

map_name() = any()

rec_ref()

rec_ref() = reference()

seconds()

seconds() = non_neg_integer()

ttl()

ttl() = seconds()

value()

value() = any()

Function Index

cache_nodes/0Return all 'up' JC nodes and all configured JC nodes.
cache_size/0Returns table size information, in records and words, for all tables used by jc.
clear/1Evict all data associated with the supplied Map.
contains_key/2Return true if the Key is in the map_name(), else false.
delete_record_by_ref/1Delete the cache element by its record reference.
evict/2Evict Map, Key.
evict_all_match/1Call evict_match/2 on all Maps.
evict_map_since/2Evict all items in the map_name() whose create_tm is older than Age seconds.
evict_match/2Evict Map, Key from the cache for Key's whose value matches the criteria.
flush/0Remove all existing items from the cache sending subscription messages to subscribers.
flush/1Remove all existing items from the cache without triggering notifications.
fun_match/3Convert the criteria,
      "a.2.d=1" to {Paths, Test}={{<<"a">>,2,<<"d">>},1}
and then ask jc_store to to apply the supplied function for the cache items whose JSON value at the path equals the Test.
get/2Retrieve the data associated with Key.
get_all/2Return a list of {K, V} for each supplied key that was found in the chache, and a list of Ks that were misses.
key_set/1Return all the keys for a given map.
map_size/1Returns the number of objects in the map.
maps/0Return a sorted list of all maps currently in the cache.
put/3Put the entry into the cache with a TTL of infinity.
put/4Put the entry into the cache with the supplied TTL.
put_all/2Put all the {K,V} tuples contained in the list.
put_all/3Put all the {K,V} pairs contained in the list.
remove_items/2Evict all K's, return all {K, V} pairs that were found.
stop/0Stop the cache at this node.
up/0Returns current datetime, datetime of cluster creation and elapsed uptime.
values/1Return all values in the given map.
values_match/2Return the Values where the value matches the supplied criteria.

Function Details

cache_nodes/0

cache_nodes() -> {{active, [node()]}, {configured, [node()]}}

Return all 'up' JC nodes and all configured JC nodes. A node is considered up if Mnesia and jc_bridge are both up.

cache_size/0

cache_size() -> {size, [{TableNm::atom(), {records, non_neg_integer()}, {bytes, non_neg_integer()}}]}

Returns table size information, in records and words, for all tables used by jc. Notice that 'cached' Key Value data are stored in the key_to_value table.

clear/1

clear(Map::map_name()) -> ok

Evict all data associated with the supplied Map.

contains_key/2

contains_key(Map::map_name(), Key::key()) -> true | false

Return true if the Key is in the map_name(), else false.

delete_record_by_ref/1

delete_record_by_ref(RecRef::rec_ref()) -> ok | {error, mnesia_abort}

Delete the cache element by its record reference. Used by jc_eviction_manager.

evict/2

evict(Map::map_name(), Key::key()) -> ok

Evict Map, Key.

evict_all_match/1

evict_all_match(Criteria::string()) -> ok

Call evict_match/2 on all Maps. Assumes the the criteria is a string in the form of "a.b.c=true", where a.b.c is a dot-path consisting of dot-searated JSON object-keys or JSON array indexes: "bed.id=10" or "bed.id.2.type.something=\"stringvalue\"".

evict_map_since/2

evict_map_since(Map::map_name(), AgeSecs::seconds()) -> ok

Evict all items in the map_name() whose create_tm is older than Age seconds.

evict_match/2

evict_match(Map::map_name(), Criteria::string()) -> ok

Evict Map, Key from the cache for Key's whose value matches the criteria. Assumes the the criteria is a string in the form of "a.b.c=true", where a.b.c is a dot-path consisting of dot-separated JSON object-keys or JSON array indexes: "bed.id=10" or "bed.id.2.type.something=\"stringvalue\"".

flush/0

flush() -> ok

Remove all existing items from the cache sending subscription messages to subscribers.

flush/1

flush(X1::silent) -> ok

Remove all existing items from the cache without triggering notifications.

fun_match/3

fun_match(Map::#{}, Criteria::string(), Fun::function()) -> {ok, term()}

Convert the criteria,

      "a.2.d=1" to {Paths, Test}={{<<"a">>,2,<<"d">>},1}
and then ask jc_store to to apply the supplied function for the cache items whose JSON value at the path equals the Test.

get/2

get(Map::map_name(), Key::key()) -> {ok, value()} | miss

Retrieve the data associated with Key. %

get_all/2

get_all(Map::map_name, Keys::[key()]) -> {ok, {[{key(), value()}], [key()]}}

Return a list of {K, V} for each supplied key that was found in the chache, and a list of Ks that were misses.

key_set/1

key_set(Map::map_name()) -> {ok, Result::[key()]}

Return all the keys for a given map.

map_size/1

map_size(Map::map_name()) -> {records, non_neg_integer()}

Returns the number of objects in the map.

maps/0

maps() -> {maps, map_name()}

Return a sorted list of all maps currently in the cache.

put/3

put(Map::map_name(), Key::key(), Value::value()) -> {ok, key()} | {error, badarg}

Put the entry into the cache with a TTL of infinity.

put/4

put(Map::map_name(), Key::key(), Value::value(), TTL::ttl()) -> {ok, key()} | {error, badarg}

Put the entry into the cache with the supplied TTL.

put_all/2

put_all(Map::map_name(), KVList::[tuple()]) -> {ok, non_neg_integer()} | {error, badarg}

Put all the {K,V} tuples contained in the list. Return the number of successes. Use infinity for the ttl.

put_all/3

put_all(Map::map_name(), KVList::[tuple()], TTL::ttl()) -> {ok, non_neg_integer()} | {error, badarg}

Put all the {K,V} pairs contained in the list. Return the number of successes. Use the supplied ttl.

remove_items/2

remove_items(Map::map_name(), Keys::[key()]) -> {ok, [{key(), value()}]}

Evict all K's, return all {K, V} pairs that were found.

stop/0

stop() -> ok

Stop the cache at this node.

up/0

up() -> {uptime, [{now, term()} | {up_at, term()} | {up_time, {term(), term()}}, ...]}

Returns current datetime, datetime of cluster creation and elapsed uptime.

values/1

values(Map::map_name()) -> {ok, [value()]}

Return all values in the given map.

values_match/2

values_match(Map::map_name(), Criteria::string()) -> {ok, [{key(), value()}]}

Return the Values where the value matches the supplied criteria. Assumes the the criteria is a string in the form of "a.b.c=true", where a.b.c is dot-path consisting of dot-separated JSON object-keys or JSON array indexes: "bed.id=10" or "bed.id.2.type.something=\"stringvalue\"".


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