AbstractSessionCache
in package
implements
SessionCacheInterface
Base class for session cache implementations.
Provides the cache key and TTL to concrete implementations, both of which are managed internally by the library. The cache key and TTL will not change during a single PHP request.
As this cache stores FileMaker Data API session tokens, which are sensitive credentials granting full API access on behalf of the authenticated user, implementors must ensure that the underlying cache storage is secure and not accessible to unauthorized parties.
To provide a custom cache backend, extend this class and implement SessionCacheInterface::get(), SessionCacheInterface::set(), and SessionCacheInterface::delete(), using self::$key and self::$ttl in your implementations.
Tags
Table of Contents
Interfaces
- SessionCacheInterface
- Interface for session cache implementations.
Properties
- $key : string
- The cache key for the current session.
- $ttl : int
- The time-to-live in seconds for cached session tokens.
Methods
- __construct() : mixed
- setKey() : void
- Sets the cache key for the current session.
- setTtl() : void
- Sets the time-to-live for cached session tokens.
Properties
$key
The cache key for the current session.
protected
string
$key
Always set by the library via SessionCacheInterface::setKey() before any cache operation is performed. Will not change during a single PHP request. Implementing classes should use this property directly in their SessionCacheInterface::get(), SessionCacheInterface::set(), and SessionCacheInterface::delete() implementations.
$ttl
The time-to-live in seconds for cached session tokens.
protected
int
$ttl
Set by the library via SessionCacheInterface::setTtl() before any cache operation is performed, defaulting to the value provided at construction time. Will not change during a single PHP request. Implementing classes should use this property directly in their SessionCacheInterface::set() implementation.
Methods
__construct()
public
__construct([int $defaultTtl = 840 ]) : mixed
Parameters
- $defaultTtl : int = 840
-
Default time-to-live in seconds for cached session tokens. Defaults to 840 seconds (14 minutes), reflecting the default FileMaker Data API session timeout. Adjust this value if your FileMaker Server is configured with a different session timeout.
setKey()
Sets the cache key for the current session.
public
final setKey(string $key) : void
This method is called internally by the library and should not be called manually. The key will not change during a single PHP request.
Parameters
- $key : string
-
The cache key to use for subsequent cache operations.
setTtl()
Sets the time-to-live for cached session tokens.
public
final setTtl(int $ttl) : void
This method is called internally by the library and should not be called manually. The TTL will not change during a single PHP request.
Parameters
- $ttl : int
-
Time-to-live in seconds for the cached session token.