ScaleOut C++ Native Client API  5.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
sosscli::ObjectPolicy Class Reference

The ObjectPolicy class contains extended parameter information for the TypedNamedCache::insert and TypedNamedCache.put methods. More...

#include <object_policy.h>

Public Types

enum  TimeoutType { Sliding = SOSSLIB_TIMEOUT_SLIDING, Absolute = SOSSLIB_TIMEOUT_ABSOLUTE, ResetOnUpdate = SOSSLIB_TIMEOUT_ABS_ON_READ }
 Enumeration used to indicate the type of timeout an object uses. More...
 
enum  PreemptionPriority { NotRemovable = 0, Normal = 1 }
 Enumeration used to indicate the priority of keeping a given object in StateServer memory. More...
 

Public Member Functions

 ObjectPolicy ()
 Default constructor. More...
 
 ObjectPolicy (NamedCache *named_cache)
 Creates an ObjectPolicy instance based off of the default policies used by a named cache instance.
 
virtual ~ObjectPolicy ()
 Destructor.
 
boost::posix_time::time_duration timeout () const
 Gets the object timeout.
 
ObjectPolicyset_timeout (boost::posix_time::time_duration timeout)
 Sets the object timeout. More...
 
TimeoutType timeout_type () const
 Gets the timeout time for the object.
 
ObjectPolicyset_timeout_type (TimeoutType timeout_type)
 Sets the timeout time for the object. More...
 
PreemptionPriority preemption_priority () const
 Gets the default preemption priority the object.
 
ObjectPolicyset_preemption_priority (PreemptionPriority preemption_priority)
 Sets the default preemption priority the object. More...
 
bool allow_push_repl () const
 Gets whether the object is subject to GeoServer "push" replication.
 
ObjectPolicyset_allow_push_repl (bool allow_push_repl)
 Sets whether the object is subject to GeoServer "push" replication. More...
 
std::vector< SossKeyparents () const
 Gets keys to objects on which the object being added depends.
 
ObjectPolicyset_parents (std::vector< SossKey > parents)
 Sets keys to objects on which the object being added depends. More...
 

Static Public Attributes

static const
boost::posix_time::time_duration 
INFINITE_TIMEOUT
 The timeout value to supply when creating a new object if you never want that object to expire due to inactivity.
 
static const
boost::posix_time::time_duration 
MAX_TIMEOUT
 The maximum allowed timeout value if an infinite timeout is not used. Currently 4,194,303 seconds.
 
static const size_t MAX_NUM_PARENTS = SOSSLIB_MAX_PARENTS
 Gets the maximum number of dependencies StateServer currently supports. Currently up to 2 parent objects are allowed.
 
static const ObjectPolicy CACHE_DEFAULTS
 ObjectPolicy constant that indicates to a named cache put/insert operation that the inserted object should the cache's default policies. More...
 

Friends

template<typename T >
class TypedNamedCache
 

Detailed Description

The ObjectPolicy class contains extended parameter information for the TypedNamedCache::insert and TypedNamedCache.put methods.

This class allows you to specify the StateServer object timeout, the type of timeout, whether the object may be removed from memory if memory availability becomes constrained, and any dependencies this object has on other StateServer objects. Advanced features such as GeoServer replication policies can also be controlled using this class.

Member Enumeration Documentation

Enumeration used to indicate the priority of keeping a given object in StateServer memory.

Enumerator
NotRemovable 

The associated object must remain in memory until its expiration is reached or the object is explicitly removed.

Normal 

The object is a candidate for removal from StateServer memory if memory pressure warrants.

Enumeration used to indicate the type of timeout an object uses.

Enumerator
Sliding 

The object uses a sliding timeout that is reset every time an object is accessed (either updated or read).

Absolute 

The object uses an absolute timeout.

ResetOnUpdate 

The object's timeout is reset when the object is updated, but it is not reset if the object is read.

Constructor & Destructor Documentation

sosscli::ObjectPolicy::ObjectPolicy ( )

Default constructor.

Creates a ObjectPolicy instance with an infinite sliding timeout, a normal preemption priority, no parents, and is eligible for GeoServer push replication.

Member Function Documentation

ObjectPolicy& sosscli::ObjectPolicy::set_allow_push_repl ( bool  allow_push_repl)
inline

Sets whether the object is subject to GeoServer "push" replication.

Returns
*this by reference to allow for chained setter method calls.
ObjectPolicy& sosscli::ObjectPolicy::set_parents ( std::vector< SossKey parents)
inline

Sets keys to objects on which the object being added depends.

Returns
*this by reference to allow for chained setter method calls.
ObjectPolicy& sosscli::ObjectPolicy::set_preemption_priority ( PreemptionPriority  preemption_priority)
inline

Sets the default preemption priority the object.

Returns
*this by reference to allow for chained setter method calls.
ObjectPolicy& sosscli::ObjectPolicy::set_timeout ( boost::posix_time::time_duration  timeout)
inline

Sets the object timeout.

Returns
*this by reference to allow for chained setter method calls.
ObjectPolicy& sosscli::ObjectPolicy::set_timeout_type ( TimeoutType  timeout_type)
inline

Sets the timeout time for the object.

Returns
*this by reference to allow for chained setter method calls.

Member Data Documentation

const ObjectPolicy sosscli::ObjectPolicy::CACHE_DEFAULTS
static

ObjectPolicy constant that indicates to a named cache put/insert operation that the inserted object should the cache's default policies.


The documentation for this class was generated from the following file: