TYPO3  7.6
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Swift_KeyCache_DiskKeyCache Class Reference
Inheritance diagram for Swift_KeyCache_DiskKeyCache:
Swift_KeyCache

Public Member Functions

 __construct (Swift_KeyCache_KeyCacheInputStream $stream, $path)
 
 setString ($nsKey, $itemKey, $string, $mode)
 
 importFromByteStream ($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
 
 getInputByteStream ($nsKey, $itemKey, Swift_InputByteStream $writeThrough=null)
 
 getString ($nsKey, $itemKey)
 
 exportToByteStream ($nsKey, $itemKey, Swift_InputByteStream $is)
 
 hasKey ($nsKey, $itemKey)
 
 clearKey ($nsKey, $itemKey)
 
 clearAll ($nsKey)
 
 __destruct ()
 

Public Attributes

const POSITION_START = 0
 
const POSITION_END = 1
 
const POSITION_CURRENT = 2
 
- Public Attributes inherited from Swift_KeyCache
const MODE_WRITE = 1
 
const MODE_APPEND = 2
 

Private Member Functions

 _prepareCache ($nsKey)
 
 _getHandle ($nsKey, $itemKey, $position)
 
 _freeHandle ($nsKey, $itemKey)
 

Private Attributes

 $_stream
 
 $_path
 
 $_keys = array()
 
 $_quotes = false
 

Detailed Description

A KeyCache which streams to and from disk.

Author
Chris Corbyn

Definition at line 16 of file DiskKeyCache.php.

Constructor & Destructor Documentation

__construct ( Swift_KeyCache_KeyCacheInputStream  $stream,
  $path 
)

Create a new DiskKeyCache with the given $stream for cloning to make InputByteStreams, and the given $path to save to.

Parameters
Swift_KeyCache_KeyCacheInputStream$stream
string$pathto save to

Definition at line 62 of file DiskKeyCache.php.

__destruct ( )

Destructor.

Definition at line 318 of file DiskKeyCache.php.

References clearAll().

Member Function Documentation

_freeHandle (   $nsKey,
  $itemKey 
)
private

Definition at line 308 of file DiskKeyCache.php.

References _getHandle().

Referenced by clearKey(), exportToByteStream(), getString(), importFromByteStream(), and setString().

_getHandle (   $nsKey,
  $itemKey,
  $position 
)
private

Get a file handle on the cache item.

Parameters
string$nsKey
string$itemKey
int$position
Returns
resource

Definition at line 289 of file DiskKeyCache.php.

References elseif, and hasKey().

Referenced by _freeHandle(), exportToByteStream(), getString(), importFromByteStream(), and setString().

_prepareCache (   $nsKey)
private

Initialize the namespace of $nsKey if needed.

Parameters
string$nsKey

Definition at line 269 of file DiskKeyCache.php.

Referenced by getString(), importFromByteStream(), and setString().

clearAll (   $nsKey)

Clear all data in the namespace $nsKey if it exists.

Parameters
string$nsKey

Implements Swift_KeyCache.

Definition at line 251 of file DiskKeyCache.php.

References clearKey().

Referenced by __destruct().

clearKey (   $nsKey,
  $itemKey 
)

Clear data for $itemKey in the namespace $nsKey if it exists.

Parameters
string$nsKey
string$itemKey

Implements Swift_KeyCache.

Definition at line 238 of file DiskKeyCache.php.

References _freeHandle(), and hasKey().

Referenced by clearAll().

exportToByteStream (   $nsKey,
  $itemKey,
Swift_InputByteStream  $is 
)

Get data back out of the cache as a ByteStream.

Parameters
string$nsKey
string$itemKey
Swift_InputByteStream$isto write the data to

Implements Swift_KeyCache.

Definition at line 202 of file DiskKeyCache.php.

References _freeHandle(), _getHandle(), hasKey(), and Swift_InputByteStream\write().

getInputByteStream (   $nsKey,
  $itemKey,
Swift_InputByteStream  $writeThrough = null 
)

Provides a ByteStream which when written to, writes data to $itemKey.

NOTE: The stream will always write in append mode.

Parameters
string$nsKey
string$itemKey
Swift_InputByteStream$writeThrough
Returns
Swift_InputByteStream

Implements Swift_KeyCache.

Definition at line 151 of file DiskKeyCache.php.

References $_stream.

getString (   $nsKey,
  $itemKey 
)

Get data back out of the cache as a string.

Parameters
string$nsKey
string$itemKey
Exceptions
Swift_IoException
Returns
string

Implements Swift_KeyCache.

Definition at line 174 of file DiskKeyCache.php.

References _freeHandle(), _getHandle(), _prepareCache(), and hasKey().

hasKey (   $nsKey,
  $itemKey 
)

Check if the given $itemKey exists in the namespace $nsKey.

Parameters
string$nsKey
string$itemKey
Returns
bool

Implements Swift_KeyCache.

Definition at line 227 of file DiskKeyCache.php.

Referenced by _getHandle(), clearKey(), exportToByteStream(), and getString().

importFromByteStream (   $nsKey,
  $itemKey,
Swift_OutputByteStream  $os,
  $mode 
)

Set a ByteStream into the cache under $itemKey for the namespace $nsKey.

See Also
MODE_WRITE, MODE_APPEND
Parameters
string$nsKey
string$itemKey
Swift_OutputByteStream$os
int$mode
Exceptions
Swift_IoException

Implements Swift_KeyCache.

Definition at line 117 of file DiskKeyCache.php.

References _freeHandle(), _getHandle(), _prepareCache(), and Swift_OutputByteStream\read().

setString (   $nsKey,
  $itemKey,
  $string,
  $mode 
)

Set a string into the cache under $itemKey for the namespace $nsKey.

See Also
MODE_WRITE, MODE_APPEND
Parameters
string$nsKey
string$itemKey
string$string
int$mode
Exceptions
Swift_IoException

Implements Swift_KeyCache.

Definition at line 84 of file DiskKeyCache.php.

References _freeHandle(), _getHandle(), and _prepareCache().

Member Data Documentation

$_keys = array()
private

Definition at line 46 of file DiskKeyCache.php.

$_path
private

Definition at line 39 of file DiskKeyCache.php.

$_quotes = false
private

Definition at line 53 of file DiskKeyCache.php.

$_stream
private

Definition at line 32 of file DiskKeyCache.php.

Referenced by getInputByteStream().

const POSITION_CURRENT = 2

Signal to leave pointer in whatever position it currently is

Definition at line 25 of file DiskKeyCache.php.

const POSITION_END = 1

Signal to place pointer at end of file

Definition at line 22 of file DiskKeyCache.php.

const POSITION_START = 0

Signal to place pointer at start of file

Definition at line 19 of file DiskKeyCache.php.