Swift_KeyCache_ArrayKeyCache
in package
implements
Swift_KeyCache
A basic KeyCache backed by an array.
Tags
Interfaces, Classes and Traits
- Swift_KeyCache
- Provides a mechanism for storing data using two keys.
Table of Contents
- $contents : array<string|int, mixed>
- Cache contents.
- $stream : Swift_KeyCache_KeyCacheInputStream
- An InputStream for cloning.
- __construct() : mixed
- Create a new ArrayKeyCache with the given $stream for cloning to make InputByteStreams.
- clearAll() : mixed
- Clear all data in the namespace $nsKey if it exists.
- clearKey() : mixed
- Clear data for $itemKey in the namespace $nsKey if it exists.
- exportToByteStream() : mixed
- Get data back out of the cache as a ByteStream.
- getInputByteStream() : Swift_InputByteStream
- Provides a ByteStream which when written to, writes data to $itemKey.
- getString() : string
- Get data back out of the cache as a string.
- hasKey() : bool
- Check if the given $itemKey exists in the namespace $nsKey.
- importFromByteStream() : mixed
- Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
- setString() : mixed
- Set a string into the cache under $itemKey for the namespace $nsKey.
- prepareCache() : mixed
- Initialize the namespace of $nsKey if needed.
Properties
$contents
Cache contents.
private
array<string|int, mixed>
$contents
= []
$stream
An InputStream for cloning.
private
Swift_KeyCache_KeyCacheInputStream
$stream
Methods
__construct()
Create a new ArrayKeyCache with the given $stream for cloning to make InputByteStreams.
public
__construct(Swift_KeyCache_KeyCacheInputStream $stream) : mixed
Parameters
- $stream : Swift_KeyCache_KeyCacheInputStream
Return values
mixed —clearAll()
Clear all data in the namespace $nsKey if it exists.
public
clearAll(string $nsKey) : mixed
Parameters
- $nsKey : string
Return values
mixed —clearKey()
Clear data for $itemKey in the namespace $nsKey if it exists.
public
clearKey(string $nsKey, string $itemKey) : mixed
Parameters
- $nsKey : string
- $itemKey : string
Return values
mixed —exportToByteStream()
Get data back out of the cache as a ByteStream.
public
exportToByteStream(string $nsKey, string $itemKey, Swift_InputByteStream $is) : mixed
Parameters
- $nsKey : string
- $itemKey : string
- $is : Swift_InputByteStream
-
to write the data to
Return values
mixed —getInputByteStream()
Provides a ByteStream which when written to, writes data to $itemKey.
public
getInputByteStream(string $nsKey, string $itemKey[, Swift_InputByteStream $writeThrough = null ]) : Swift_InputByteStream
NOTE: The stream will always write in append mode.
Parameters
- $nsKey : string
- $itemKey : string
- $writeThrough : Swift_InputByteStream = null
Return values
Swift_InputByteStream —getString()
Get data back out of the cache as a string.
public
getString(string $nsKey, string $itemKey) : string
Parameters
- $nsKey : string
- $itemKey : string
Return values
string —hasKey()
Check if the given $itemKey exists in the namespace $nsKey.
public
hasKey(string $nsKey, string $itemKey) : bool
Parameters
- $nsKey : string
- $itemKey : string
Return values
bool —importFromByteStream()
Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
public
importFromByteStream(string $nsKey, string $itemKey, Swift_OutputByteStream $os, int $mode) : mixed
Parameters
- $nsKey : string
- $itemKey : string
- $os : Swift_OutputByteStream
- $mode : int
Tags
Return values
mixed —setString()
Set a string into the cache under $itemKey for the namespace $nsKey.
public
setString(string $nsKey, string $itemKey, string $string, int $mode) : mixed
Parameters
- $nsKey : string
- $itemKey : string
- $string : string
- $mode : int
Tags
Return values
mixed —prepareCache()
Initialize the namespace of $nsKey if needed.
private
prepareCache(string $nsKey) : mixed
Parameters
- $nsKey : string