| FireSale | R Documentation |
A FireSale plugin
A FireSale plugin
The class encapsulates the firesale functionality into a fiery plugin. You use it by creating and attaching it to a fiery server object.
A new 'FireSale'-object is initialized using the new() method on the
generator (shown here with the environment driver):
Usage
datastore <- FireSale$new(storr::driver_environment())
|
This class is mainly intended to be used as a fiery plugin, by attaching it
to a fiery server object. It works by providing a datastore element (name
can be modified with the arg_name argument during initialization) in the
arg_list argument to request handlers. The object contains two elements,
global and session. The first contains data shared by all sessions, while
the latter is scoped to the current session. Both of these elements are
list-like, but in reality are interfaces to the underlying data store
nameThe name of the plugin
arg_nameThe name of the argument that will contain the data store
new()Initializes a new FireSale object
FireSale$new( driver, arg_name = "datastore", gc_interval = 3600, max_age = gc_interval )
driverA storr driver to use for the backend
arg_nameA string giving the name under which the data store
should appear in the arg_list argument
gc_intervalThe interval with which the backend should be garbage collected. The value is indicative and a garbage collection may happen at longer intervals
max_ageThe maximum age in second an ID can be left unused before being purged. The value is indicative and a stale ID store may linger longer than this
format()Textual representation of the plugin
FireSale$format(...)
...ignored
get_mall()Create a mall (a collection of storefronts) containing a global and a session-specific storefront
FireSale$get_mall(id)
idThe session id of the current session
shiny_mall()Create a mall from a shiny session object. If the shiny app has been launched from a plumber2 server the session id is automatically resolved. If not, you must provide an id function that extracts the session id from a reqres::Request object.
FireSale$shiny_mall(session, id_fun = NULL)
sessionA ShinySession object
id_funA function that can extract the session ID from a Request
object. This is handled automatically for shiny apps launched from a
plumber2 server. The default id function for fiery servers is constructed
with fiery::session_id_cookie()
on_attach()Method for use by fiery when attached as a plugin. Should
not be called directly.
FireSale$on_attach(app, ...)
appThe fiery server object
...Ignored
clone()The objects of this class are cloneable with this method.
FireSale$clone(deep = FALSE)
deepWhether to make a deep clone.
# Create a datastore object
ds <- FireSale$new(storr::driver_environment())
# Attach it to a fiery server
app <- fiery::Fire$new()
app$attach(ds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.