Invoking the Infinispan REST Server API from R

The following script demonstrates the R Infinispan API functions for calling an instance of the Infinispan REST Server; the image below shows the output.

In this example the user transforms a data frame into JSON, puts (via DoPut) that JSON into the cache, and then gets this information (via DoGet) as JSON and transforms it back into a data frame.

library ('ropensecretsapi')
library ('RJSONIO')
library ('rinfinispanapi')

ropensecretsapi::SetAPIKey ("redacted")

params <- list (org="Microsoft")
msftDataFrame <- ropensecretsapi::GetOrgsData (params)
msftAsJson <- RJSONIO::toJSON (msftDataFrame)

SetEndpointURL ("")
# Expected "Error: Not Found" as the entry does not exist in the cache.
DoGet  ("___defaultcache", cacheKey="msft")
DoPut (
    headers=list ("Content-Type"="application/json")
newMsftAsJson <- DoGet  ("___defaultcache", cacheKey="msft")
newMsftDataFrame <- RJSONIO::fromJSON (newMsftAsJson)
DoHead ("___defaultcache", cacheKey="msft")
DoDelete ("___defaultcache", cacheKey="msft")
# Expected "Error: Not Found" as the entry has been deleted.
DoGet  ("___defaultcache", cacheKey="msft")

An example script that calls the Infinispan REST Server from R