CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.1 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.1
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
    • Network
      • Email
      • Http
    • Routing
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • ApcEngine
  • FileEngine
  • MemcacheEngine
  • WincacheEngine
  • XcacheEngine

Class FileEngine

File Storage engine for cache. Filestorage is the slowest cache storage to read and write. However, it is good for servers that don't have other storage engine available, or have content which is not performance sensitive.

You can configure a FileEngine cache, using Cache::config()

CacheEngine
Extended by FileEngine
Package: Cake\Cache\Engine
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Cache/Engine/FileEngine.php

Properties summary

  • $_File protected
    File
    Instance of SplFileObject class
  • $_init protected
    boolean
    True unless FileEngine::__active(); fails
  • $settings public
    array
    Settings

Method Summary

  • _active() protected
    Determine is cache directory is writable
  • _setKey() protected

    Sets the current cache key this class is managing, and creates a writable SplFileObject for the cache file the key is referring to.

  • clear() public
    Delete all values from the cache
  • decrement() public
    Not implemented
  • delete() public
    Delete a key from the cache
  • gc() public
    Garbage collection. Permanently remove all expired and deleted data
  • increment() public
    Not implemented
  • init() public
    Initialize the Cache Engine
  • read() public
    Read a key from the cache
  • write() public
    Write data for key into cache

Method Detail

_active() protected ¶

_active( )

Determine is cache directory is writable

Returns
boolean

_setKey() protected ¶

_setKey( string $key , boolean $createKey = false )

Sets the current cache key this class is managing, and creates a writable SplFileObject for the cache file the key is referring to.

Parameters
string $key
The key
boolean $createKey optional false
Whether the key should be created if it doesn't exists, or not
Returns
boolean
true if the cache key could be set, false otherwise

clear() public ¶

clear( boolean $check )

Delete all values from the cache

Parameters
boolean $check
Optional - only delete expired cache items
Returns
boolean
True if the cache was successfully cleared, false otherwise

decrement() public ¶

decrement( string $key , integer $offset = 1 )

Not implemented

Parameters
string $key
integer $offset optional 1
Throws
CacheException

delete() public ¶

delete( string $key )

Delete a key from the cache

Parameters
string $key
Identifier for the data
Returns
boolean
True if the value was successfully deleted, false if it didn't exist or couldn't be removed

gc() public ¶

gc( )

Garbage collection. Permanently remove all expired and deleted data

Returns
boolean
True if garbage collection was successful, false on failure
Overrides
CacheEngine::gc()

increment() public ¶

increment( string $key , integer $offset = 1 )

Not implemented

Parameters
string $key
integer $offset optional 1
Throws
CacheException

init() public ¶

init( array $settings = array() )

Initialize the Cache Engine

Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());

Parameters
array $settings optional array()
array of setting for the engine
Returns
boolean
True if the engine has been successfully initialized, false if not
Overrides
CacheEngine::init()

read() public ¶

read( string $key )

Read a key from the cache

Parameters
string $key
Identifier for the data
Returns
mixed
The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it

write() public ¶

write( string $key , mixed $data , mixed $duration )

Write data for key into cache

Parameters
string $key
Identifier for the data
mixed $data
Data to be cached
mixed $duration
How long to cache the data, in seconds
Returns
boolean
True if the data was successfully cached, false on failure

Methods inherited from CacheEngine

key() public ¶

key( string $key )

Generates a safe key for use with cache engine storage engines.

Parameters
string $key
the key passed over
Returns
mixed
string $key or false

settings() public ¶

settings( )

Cache Engine settings

Returns
array
settings

Properties detail

$_File ¶

protected File

Instance of SplFileObject class

null

$_init ¶

protected boolean

True unless FileEngine::__active(); fails

true

$settings ¶

public array

Settings

  • path = absolute path to cache directory, default => CACHE
  • prefix = string prefix for filename, default => cake_
  • lock = enable file locking on write, default => false
  • serialize = serialize the data, default => true
See
CacheEngine::__defaults
array()
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs