NAME
Starch::Manager - Entry point for accessing Starch state objects.
SYNOPSIS
See Starch.
DESCRIPTION
This module provides a generic interface to managing the storage of state data.
Typically you will be using the Starch module to create this object.
This class supports method proxies as described in "METHOD PROXIES" in Starch.
REQUIRED ARGUMENTS
store
The Starch::Store storage backend to use for persisting the state data. A hashref must be passed and it is expected to contain at least a class
key and will be converted into a store object automatically.
The class
can be fully qualified, or relative to the Starch::Store
namespace. A leading ::
signifies that the store's package name is relative.
More information about stores can be found at "STORES" in Starch.
OPTIONAL ARGUMENTS
expires
How long, in seconds, a state should live after the last time it was modified. Defaults to 60 * 60 * 2
(2 hours).
See "EXPIRATION" in Starch for more information.
plugins
Which plugins to apply to the Starch objects, specified as an array ref of plugin names. The plugin names can be fully qualified, or relative to the Starch::Plugin
namespace. A leading ::
signifies that the plugin's package name is relative.
Plugins can modify nearly any functionality in Starch. More information about plugins, as well as which plugins are available, can be found at "PLUGINS" in Starch.
namespace
The root array ref namespace to put starch data in. In most cases this is just prepended to the state ID and used as the key for storing the state data. Defaults to ['starch-state']
.
If you are using the same store for independent application states you may want to namespace them so that you can easly identify which application a particular state belongs to when looking in the store.
expires_state_key
The state key to store the "expires" in Starch::State value in. Defaults to __STARCH_EXPIRES__
.
modified_state_key
The state key to store the "modified" in Starch::State value in. Defaults to __STARCH_MODIFIED__
.
created_state_key
The state key to store the "created" in Starch::State value in. Defaults to __STARCH_CREATED__
.
no_store_state_key
This key is used by stores to mark state data as not to be stored. Defaults to __STARCH_NO_STORE__
.
This is used by the Starch::Plugin::LogStoreExceptions and Starch::Plugin::ThrottleStore plugins to avoid losing state data in the store when errors or throttling is encountered.
dirty_state_key
This key is used to artificially mark as state as dirty by incrementing the value of this key. Used by "mark_dirty" in Starch::State.
ATTRIBUTES
factory
The Starch::Factory object which applies plugins and handles the construction of the manager, state, and store objects.
state_id_type
The Type::Tiny object to validate the state ID when "state" is called. Defaults to NonEmptySimpleStr.
METHODS
state
my $new_state = $starch->state();
my $existing_state = $starch->state( $id );
Returns a new Starch::State (or whatever "state_class" in Starch::Factory returns) object for the specified state ID.
If no ID is specified, or is undef, then an ID will be automatically generated.
Additional arguments can be passed after the ID argument. These extra arguments will be passed to the state object constructor.
state_id_seed
Returns a fairly unique string used for seeding "id" in Starch::State.
generate_state_id
Generates and returns a new state ID which is a SHA-1 hex digest of calling "state_id_seed".
clone_data
Clones complex perl data structures. Used internally to build "data" in Starch::State from "original_data" in Starch::State.
is_data_diff
Given two bits of data (scalar, array ref, or hash ref) this returns true if the data is different. Used internally by "is_dirty" in Starch::State.
SUPPORT
See "SUPPORT" in Starch.
AUTHORS
See "AUTHORS" in Starch.