Key Value Cache Store - libertylocked/RestRPC GitHub Wiki

1 Cache Store Overview

Server keeps a Key-Value cache store for each Service. A Service's cache store is created when the Service sends its first cache request, and is deleted when the Service disconnects.

The cache store allows the Service to actively push data to the server, that the Client can obtain directly from the Server without having to compose a Request object.

2 Cache request

A Service sends a Cache request to request the server to update the key-value cache store for this Service. The Cache request has the following members:

string Header = "c"
  • This member is REQUIRED
  • Header for a cache request MUST be a string "c"
CacheObject Data
  • This member is REQUIRED
  • The value for this member MUST be an Object as defined in section 2.1

2.1 Cache object

string Key
  • This member is REQUIRED
  • A string indicating the key to the K-V store
object Value
  • This member is REQUIRED
  • A Primitive or Structured value to be stored by the Key

3 Examples

{"Header":"c", "Data":{"Key":"PlayerStats", "Value":{"Name":"Trevor", "Health":100}}