1712. Class

1712.1. Zend\Session\Container

Session storage container

Allows for interacting with session storage in isolated containers, which may have their own expiries, or even expiries per key in the container. Additionally, expiries may be absolute TTLs or measured in “hops”, which are based on how many times the key or container were accessed.

1712.1.1. Methods

1712.1.1.1. __construct

__construct()

Constructor

Provide a name (‘Default’ if none provided) and a ManagerInterface instance.

Parameters:
  • null|string
  • Manager
Throws ExceptionInvalidArgumentException:
 

1712.1.1.2. setDefaultManager

setDefaultManager()

Set the default ManagerInterface instance to use when none provided to constructor

Parameters:Manager
Return type:void

1712.1.1.3. getDefaultManager

getDefaultManager()

Get the default ManagerInterface instance

If none provided, instantiates one of type {@link $managerDefaultClass}

Return type:Manager
Throws :ExceptionInvalidArgumentException if invalid manager default class provided

1712.1.1.4. getName

getName()

Get container name

Return type:string

1712.1.1.5. setManager

setManager()

Set session manager

Parameters:null|Manager
Return type:Container
Throws :ExceptionInvalidArgumentException

1712.1.1.6. getManager

getManager()

Get manager instance

Return type:Manager

1712.1.1.7. getStorage

getStorage()

Get session storage object

Proxies to ManagerInterface::getStorage()

Return type:Storage

1712.1.1.8. createContainer

createContainer()

Create a new container object on which to act

Return type:ArrayObject

1712.1.1.9. verifyNamespace

verifyNamespace()

Verify container namespace

Checks to see if a container exists within the Storage object already. If not, one is created; if so, checks to see if it’s an ArrayObject. If not, it raises an exception; otherwise, it returns the Storage object.

Parameters:bool – Whether or not to create the container for the namespace
Return type:Storage|null Returns null only if $createContainer is false
Throws :ExceptionRuntimeException

1712.1.1.10. expireKeys

expireKeys()

Determine whether a given key needs to be expired

Returns true if the key has expired, false otherwise.

Parameters:null|string
Return type:bool

1712.1.1.11. expireByExpiryTime

expireByExpiryTime()

Expire a key by expiry time

Checks to see if the entire container has expired based on TTL setting, or the individual key.

Parameters:
  • Storage
  • string – Container name
  • string – Key in container to check
Return type:

bool

1712.1.1.12. expireByHops

expireByHops()

Expire key by session hops

Determines whether the container or an individual key within it has expired based on session hops

Parameters:
  • Storage
  • string
  • string
Return type:

bool

1712.1.1.13. offsetSet

offsetSet()

Store a value within the container

Parameters:
  • string
  • mixed
Return type:

void

1712.1.1.14. offsetExists

offsetExists()

Determine if the key exists

Parameters:string
Return type:bool

1712.1.1.15. offsetGet

offsetGet()

Retrieve a specific key in the container

Parameters:string
Return type:mixed

1712.1.1.16. offsetUnset

offsetUnset()

Unset a single key in the container

Parameters:string
Return type:void

1712.1.1.17. exchangeArray

exchangeArray()

Exchange the current array with another array or object.

Parameters:array|object
Return type:array Returns the old array
See :

1712.1.1.18. getIterator

getIterator()

Iterate over session container

Return type:Iterator

1712.1.1.19. setExpirationSeconds

setExpirationSeconds()

Set expiration TTL

Set the TTL for the entire container, a single key, or a set of keys.

Parameters:
  • int – TTL in seconds
  • string|array|null
Return type:

Container

Throws :

ExceptionInvalidArgumentException

1712.1.1.20. setExpirationHops

setExpirationHops()

Set expiration hops for the container, a single key, or set of keys

Parameters:
  • int
  • null|string|array
Throws ExceptionInvalidArgumentException:
 
Return type:

Container