Documentation

Swift_KeyCache_DiskKeyCache
in package
implements Swift_KeyCache

A KeyCache which streams to and from disk.

Tags
author

Chris Corbyn

Interfaces, Classes and Traits

Swift_KeyCache
Provides a mechanism for storing data using two keys.

Table of Contents

POSITION_CURRENT  = 2
Signal to leave pointer in whatever position it currently is
POSITION_END  = 1
Signal to place pointer at end of file
POSITION_START  = 0
Signal to place pointer at start of file
$keys  : array<string|int, mixed>
Stored keys.
$path  : string
A path to write to.
$stream  : Swift_KeyCache_KeyCacheInputStream
An InputStream for cloning.
__construct()  : mixed
Create a new DiskKeyCache with the given $stream for cloning to make InputByteStreams, and the given $path to save to.
__destruct()  : mixed
Destructor.
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.
freeHandle()  : mixed
getHandle()  : resource
Get a file handle on the cache item.
prepareCache()  : mixed
Initialize the namespace of $nsKey if needed.

Constants

POSITION_CURRENT

Signal to leave pointer in whatever position it currently is

public mixed POSITION_CURRENT = 2

POSITION_END

Signal to place pointer at end of file

public mixed POSITION_END = 1

POSITION_START

Signal to place pointer at start of file

public mixed POSITION_START = 0

Properties

$keys

Stored keys.

private array<string|int, mixed> $keys = []

Methods

__destruct()

Destructor.

public __destruct() : mixed
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

getString()

Get data back out of the cache as a string.

public getString(string $nsKey, string $itemKey) : string
Parameters
$nsKey : string
$itemKey : string
Tags
throws
Swift_IoException
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
see

MODE_WRITE, MODE_APPEND

throws
Swift_IoException
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
see

MODE_WRITE, MODE_APPEND

throws
Swift_IoException
Return values
mixed

freeHandle()

private freeHandle(mixed $nsKey, mixed $itemKey) : mixed
Parameters
$nsKey : mixed
$itemKey : mixed
Return values
mixed

getHandle()

Get a file handle on the cache item.

private getHandle(string $nsKey, string $itemKey, int $position) : resource
Parameters
$nsKey : string
$itemKey : string
$position : int
Return values
resource

prepareCache()

Initialize the namespace of $nsKey if needed.

private prepareCache(string $nsKey) : mixed
Parameters
$nsKey : string
Return values
mixed

Search results