ICanBoogie/Storage 2.1.x
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • Storage
      • Codec
      • Storage

Classes

  • APCStorage
  • CacheCollection
  • FileStorage
  • FileStorageIterator
  • RedisStorage
  • RunTimeStorage
  • StorageCollection

Interfaces

  • Cache
  • Codec
  • Storage

Class FileStorage

A storage using the file system.

ICanBoogie\Storage\FileStorage implements ICanBoogie\Storage\Storage, ArrayAccess uses ICanBoogie\Storage\Storage\ArrayAccess, ICanBoogie\Storage\Storage\ClearWithIterator
Namespace: ICanBoogie\Storage
Located at FileStorage.php

Methods summary

public
# __construct( string $path, ICanBoogie\Storage\Codec $codec = null )

Constructor.

Constructor.

Parameters

$path
Absolute path to the storage directory.
$codec
public boolean
# exists( $key )

Parameters

$key

Returns

boolean
true if the key exists, false otherwise.

Inheritdoc

Implementation of

ICanBoogie\Storage\Cache::exists()
public mixed|null
# retrieve( mixed $key, $default = null )

Parameters

$key
$default The value returned if the key does not exists. Defaults to null.
$default

Returns

mixed|null
The value associated with the key, or null if the key doesn't exists.

Inheritdoc

Implementation of

ICanBoogie\Storage\Cache::retrieve()
public
# store( string $key, mixed $value, string $ttl = 0 )

Parameters

$key

Store the variable using this name. keys are cache-unique, so storing a second value with the same key will overwrite the original value.

$value
The value to store.
$ttl

Time To Live; store value in the cache for ttl seconds. After the ttl has passed, the stored value won't be available for the next request. If no ttl is supplied (or if the ttl is empty), the value will persist until it is removed from the cache manually, or otherwise fails to exist in the cache.

Throws

Exception
when a file operation fails.

Inheritdoc

Implementation of

ICanBoogie\Storage\Storage::store()
public
# eliminate( string $key )

Parameters

$key

Inheritdoc

Implementation of

ICanBoogie\Storage\Storage::eliminate()
protected string
# normalize_key( string $key )

Normalizes a key into a valid filename.

Normalizes a key into a valid filename.

Parameters

$key

Returns

string
protected string
# format_pathname( string $key )

Formats a key into an absolute pathname.

Formats a key into an absolute pathname.

Parameters

$key

Returns

string
protected string
# format_pathname_with_ttl( string $pathname )

Formats a pathname with a TTL extension.

Formats a pathname with a TTL extension.

Parameters

$pathname

Returns

string
protected string
# serialize( mixed $value )

Serializes a value so that it can be stored.

Serializes a value so that it can be stored.

Parameters

$value

Returns

string
protected mixed
# unserialize( string $value )

Unserializes a value retrieved from storage.

Unserializes a value retrieved from storage.

Parameters

$value

Returns

mixed
public Iterator
# getIterator( )

Returns

Iterator

Inheritdoc

Implementation of

ICanBoogie\Storage\Cache::getIterator()
public ICanBoogie\Storage\FileStorageIterator
# matching( string $regex )

Returns an iterator for the keys matching a specified regex.

Returns an iterator for the keys matching a specified regex.

Parameters

$regex

Returns

ICanBoogie\Storage\FileStorageIterator
public boolean
# check_writable( )

Checks whether the storage directory is writable.

Checks whether the storage directory is writable.

Returns

boolean

Throws

Exception
when the storage directory is not writable.

Methods inherited from ICanBoogie\Storage\Storage

clear()

Methods inherited from ArrayAccess

offsetExists(), offsetGet(), offsetSet(), offsetUnset()

Methods used from ICanBoogie\Storage\Storage\ArrayAccess

offsetExists(), offsetGet(), offsetSet(), offsetUnset()

Methods used from ICanBoogie\Storage\Storage\ClearWithIterator

clear()

Properties summary

protected string $path

Absolute path to the storage directory.

Absolute path to the storage directory.

#
ICanBoogie/Storage 2.1.x API documentation generated by ApiGen