26. Class

26.1. Zend\Cache\Storage\Adapter\Filesystem

26.1.1. Methods

26.1.1.1. setOptions

setOptions()

Set options.

Parameters:array|Traversable|FilesystemOptions
Return type:Filesystem
See :

26.1.1.2. getOptions

getOptions()

Get options.

Return type:FilesystemOptions
See :

26.1.1.3. flush

flush()

Flush the whole storage

Return type:bool

26.1.1.4. clearExpired

clearExpired()

Remove expired items

Return type:bool

26.1.1.5. clearByNamespace

clearByNamespace()

Remove items by given namespace

Parameters:string
Throws ExceptionRuntimeException:
 
Return type:bool

26.1.1.6. clearByPrefix

clearByPrefix()

Remove items matching given prefix

Parameters:string
Throws ExceptionRuntimeException:
 
Return type:bool

26.1.1.7. setTags

setTags()

Set tags to an item by given key. An empty array will remove all tags.

Parameters:
  • string
  • string[]
Return type:

bool

26.1.1.8. getTags

getTags()

Get tags of an item by given key

Parameters:string
Return type:string[]|FALSE

26.1.1.9. clearByTags

clearByTags()

Remove items matching given tags.

If $disjunction only one of the given tags must match else all given tags must match.

Parameters:
  • string[]
  • bool
Return type:

bool

26.1.1.10. getIterator

getIterator()

Get the storage iterator

Return type:FilesystemIterator

26.1.1.11. optimize

optimize()

Optimize the storage

Return type:bool
Return type:ExceptionRuntimeException

26.1.1.12. getTotalSpace

getTotalSpace()

Get total space in bytes

Return type:int|float

26.1.1.13. getAvailableSpace

getAvailableSpace()

Get available space in bytes

Return type:int|float

26.1.1.14. getItem

getItem()

Get an item.

Parameters:
  • string
  • bool
  • mixed
Return type:

mixed Data on success, null on failure

Throws :

ExceptionExceptionInterface @triggers getItem.pre(PreEvent)

@triggers getItem.post(PostEvent) @triggers getItem.exception(ExceptionEvent)

26.1.1.15. getItems

getItems()

Get multiple items.

Parameters:array
Return type:array Associative array of keys and values
Throws :ExceptionExceptionInterface @triggers getItems.pre(PreEvent)

@triggers getItems.post(PostEvent) @triggers getItems.exception(ExceptionEvent)

26.1.1.16. internalGetItem

internalGetItem()

Internal method to get an item.

Parameters:
  • string
  • bool
  • mixed
Return type:

mixed Data on success, null on failure

Throws :

ExceptionExceptionInterface

26.1.1.17. internalGetItems

internalGetItems()

Internal method to get multiple items.

Parameters:array
Return type:array Associative array of keys and values
Throws :ExceptionExceptionInterface

26.1.1.18. hasItem

hasItem()

Test if an item exists.

Parameters:string
Return type:bool
Throws :ExceptionExceptionInterface @triggers hasItem.pre(PreEvent)

@triggers hasItem.post(PostEvent) @triggers hasItem.exception(ExceptionEvent)

26.1.1.19. hasItems

hasItems()

Test multiple items.

Parameters:array
Return type:array Array of found keys
Throws :ExceptionExceptionInterface @triggers hasItems.pre(PreEvent)

@triggers hasItems.post(PostEvent) @triggers hasItems.exception(ExceptionEvent)

26.1.1.20. internalHasItem

internalHasItem()

Internal method to test if an item exists.

Parameters:string
Return type:bool
Throws :ExceptionExceptionInterface

26.1.1.21. getMetadata

getMetadata()

Get metadata

Parameters:string
Return type:array|bool Metadata on success, false on failure

26.1.1.22. getMetadatas

getMetadatas()

Get metadatas

Parameters:
  • array
  • array
Return type:

array Associative array of keys and metadata

26.1.1.23. internalGetMetadata

internalGetMetadata()

Get info by key

Parameters:string
Return type:array|bool Metadata on success, false on failure

26.1.1.24. internalGetMetadatas

internalGetMetadatas()

Internal method to get multiple metadata

Parameters:array
Return type:array Associative array of keys and metadata
Throws :ExceptionExceptionInterface

26.1.1.25. setItem

setItem()

Store an item.

Parameters:
  • string
  • mixed
Return type:

bool

Throws :

ExceptionExceptionInterface @triggers setItem.pre(PreEvent)

@triggers setItem.post(PostEvent) @triggers setItem.exception(ExceptionEvent)

26.1.1.26. setItems

setItems()

Store multiple items.

Parameters:array
Return type:array Array of not stored keys
Throws :ExceptionExceptionInterface @triggers setItems.pre(PreEvent)

@triggers setItems.post(PostEvent) @triggers setItems.exception(ExceptionEvent)

26.1.1.27. addItem

addItem()

Add an item.

Parameters:
  • string
  • mixed
Return type:

bool

Throws :

ExceptionExceptionInterface @triggers addItem.pre(PreEvent)

@triggers addItem.post(PostEvent) @triggers addItem.exception(ExceptionEvent)

26.1.1.28. addItems

addItems()

Add multiple items.

Parameters:array
Return type:bool
Throws :ExceptionExceptionInterface @triggers addItems.pre(PreEvent)

@triggers addItems.post(PostEvent) @triggers addItems.exception(ExceptionEvent)

26.1.1.29. replaceItem

replaceItem()

Replace an existing item.

Parameters:
  • string
  • mixed
Return type:

bool

Throws :

ExceptionExceptionInterface @triggers replaceItem.pre(PreEvent)

@triggers replaceItem.post(PostEvent) @triggers replaceItem.exception(ExceptionEvent)

26.1.1.30. replaceItems

replaceItems()

Replace multiple existing items.

Parameters:array
Return type:bool
Throws :ExceptionExceptionInterface @triggers replaceItems.pre(PreEvent)

@triggers replaceItems.post(PostEvent) @triggers replaceItems.exception(ExceptionEvent)

26.1.1.31. internalSetItem

internalSetItem()

Internal method to store an item.

Parameters:
  • string
  • mixed
Return type:

bool

Throws :

ExceptionExceptionInterface

26.1.1.32. internalSetItems

internalSetItems()

Internal method to store multiple items.

Parameters:array
Return type:array Array of not stored keys
Throws :ExceptionExceptionInterface

26.1.1.33. checkAndSetItem

checkAndSetItem()

Set an item only if token matches

It uses the token received from getItem() to check if the item has changed before overwriting it.

Parameters:
  • mixed
  • string
  • mixed
Return type:

bool

Throws :

ExceptionExceptionInterface

See :
See :

26.1.1.34. internalCheckAndSetItem

internalCheckAndSetItem()

Internal method to set an item only if token matches

Parameters:
  • mixed
  • string
  • mixed
Return type:

bool

Throws :

ExceptionExceptionInterface

See :
See :

26.1.1.35. touchItem

touchItem()

Reset lifetime of an item

Parameters:string
Return type:bool
Throws :ExceptionExceptionInterface @triggers touchItem.pre(PreEvent)

@triggers touchItem.post(PostEvent) @triggers touchItem.exception(ExceptionEvent)

26.1.1.36. touchItems

touchItems()

Reset lifetime of multiple items.

Parameters:array
Return type:array Array of not updated keys
Throws :ExceptionExceptionInterface @triggers touchItems.pre(PreEvent)

@triggers touchItems.post(PostEvent) @triggers touchItems.exception(ExceptionEvent)

26.1.1.37. internalTouchItem

internalTouchItem()

Internal method to reset lifetime of an item

Parameters:string
Return type:bool
Throws :ExceptionExceptionInterface

26.1.1.38. removeItem

removeItem()

Remove an item.

Parameters:string
Return type:bool
Throws :ExceptionExceptionInterface @triggers removeItem.pre(PreEvent)

@triggers removeItem.post(PostEvent) @triggers removeItem.exception(ExceptionEvent)

26.1.1.39. removeItems

removeItems()

Remove multiple items.

Parameters:array
Return type:array Array of not removed keys
Throws :ExceptionExceptionInterface @triggers removeItems.pre(PreEvent)

@triggers removeItems.post(PostEvent) @triggers removeItems.exception(ExceptionEvent)

26.1.1.40. internalRemoveItem

internalRemoveItem()

Internal method to remove an item.

Parameters:string
Return type:bool
Throws :ExceptionExceptionInterface

26.1.1.41. internalGetCapabilities

internalGetCapabilities()

Internal method to get capabilities of this adapter

Return type:Capabilities

26.1.1.42. rmDir

rmDir()

Removes directories recursive by namespace

Parameters:
  • string – Directory to delete
  • string – Namespace + Separator
Return type:

bool

26.1.1.43. getFileSpec

getFileSpec()

Get file spec of the given key and namespace

Parameters:string
Return type:string

26.1.1.44. readInfoFile

readInfoFile()

Read info file

Parameters:
  • string
  • bool – Don’t block script if file is locked
  • bool – The optional argument is set to TRUE if the lock would block
Return type:

array|bool The info array or false if file wasn’t found

Throws :

ExceptionRuntimeException

26.1.1.45. getFileContent

getFileContent()

Read a complete file

Parameters:
  • string – File complete path
  • bool – Don’t block script if file is locked
  • bool – The optional argument is set to TRUE if the lock would block
Return type:

string

Throws :

ExceptionRuntimeException

26.1.1.46. prepareDirectoryStructure

prepareDirectoryStructure()

Prepares a directory structure for the given file(spec) using the configured directory level.

Parameters:string
Return type:void
Throws :ExceptionRuntimeException

26.1.1.47. putFileContent

putFileContent()

Write content to a file

Parameters:
  • string – File complete path
  • string – Data to write
  • bool – Don’t block script if file is locked
  • bool – The optional argument is set to TRUE if the lock would block
Return type:

void

Throws :

ExceptionRuntimeException