KWeb  6.4
CacheBlock Class Reference

Public Member Functions

 enabled ($enabled=null)
 reset ($path)
 Resets cache with specified path (unlinks it)
 resetItems ($items)
 Czyści wszystkie bloki zależne od podanych elementów.
 resetAllItems ($genre=false)
 resetItemsStart ()
 Starts collecting items to reset Subsequent calls to resetItems will be delayed until resetItemsFinish is called It's safe to call this function many times.
 resetItemsFinish ()
 Performs reset of all collected item ids by resetItemsStart.
 resetAll ()
 start ($id, $items=false, $unique=false, $timeout=-1)
 Rozpoczyna tekstowy blok cache'a.
 makePath ($cacheType, $id, $items=false, $unique=false, $group=true)
 Returns path to the cache file.
 read ($path, $timeout=null)
 Wczytuje zapisane wcześniej dane.
 cancel ()
 Cancels all currently active blocks.
 end ($store=true)
 isCaching ()
 write ($path, &$data)

Static Public Member Functions

static instance ($create=true)
static safeWrite ($path, &$string)

Data Fields

const TEXT = 'txt'
const PHP = 'php'
const SERIALIZED = 'dat'
 $cachePath
 $blocks = array()
 $dirPrefix = 'block_'
 $dirTaggedPrefix = 'tagged_'
 $chmodDir = null
 $chmodFile = null
 $globalPrefix = ''
 Global prefix to be used on all CacheBlock ids.
 $wasCanceled = false
 TRUE if any cache block was ever canceled.

Static Public Attributes

static $inst = null

Protected Member Functions

 __construct ()

Protected Attributes

 $enabled = false
 $resetItemsCollection = null

Constructor & Destructor Documentation

CacheBlock::__construct ( ) [protected]

Member Function Documentation

CacheBlock::cancel ( )

Cancels all currently active blocks.

Their result won't be stored

CacheBlock::enabled ( enabled = null)
CacheBlock::end ( store = true)
static CacheBlock::instance ( create = true) [static]
Returns:
CacheBlock
CacheBlock::isCaching ( )
CacheBlock::makePath ( cacheType,
id,
items = false,
unique = false,
group = true 
)

Returns path to the cache file.

Parameters:
$cacheType- Type of cache file
$id- Unique cache file identifier
$items- List of item identifiers, that this cache item depends on...
$unique- Additional unique parameter (string or array)
$group- Group of cache files - TRUE to use the prefix, FALSE to not use it, or STRING to group with own name
Returns:
NULL|string
CacheBlock::read ( path,
timeout = null 
)

Wczytuje zapisane wcześniej dane.

Jeżeli nie istnieją, zwraca null.

Parameters:
$timeout- Timeout to use, 0 or FALSE means no timeout, below 0 or NULL will use KSetting::$inst->cache_block_expire
CacheBlock::reset ( path)

Resets cache with specified path (unlinks it)

CacheBlock::resetAll ( )
CacheBlock::resetAllItems ( genre = false)
CacheBlock::resetItems ( items)

Czyści wszystkie bloki zależne od podanych elementów.

CacheBlock::resetItemsFinish ( )

Performs reset of all collected item ids by resetItemsStart.

CacheBlock::resetItemsStart ( )

Starts collecting items to reset Subsequent calls to resetItems will be delayed until resetItemsFinish is called It's safe to call this function many times.

First call to resetItemsFinish will reset all collected items.

static CacheBlock::safeWrite ( path,
&$  string 
) [static]
CacheBlock::start ( id,
items = false,
unique = false,
timeout = -1 
)

Rozpoczyna tekstowy blok cache'a.

Gdy zwraca false - wydrukował blok, nie należy wywoływać cacheowanego bloku ANI wywoływać CacheBlock::$inst->end().

np.:

if (CacheBlock::$inst->start('cacheblock')) { echo 'Hello world!'; CacheBlock::$inst->end(); }

Parameters:
$id- unikalne id bloku, jeżeli jest FALSE zostanie po prostu podbity blok
$items- array, lub string z listą id elementów, których blok dotyczy. Jako ITEMID, lub GENRE-ITEMID
$unique- unikalny string od którego blok jest zależny (np. godzina)
CacheBlock::write ( path,
&$  data 
)

Field Documentation

CacheBlock::$blocks = array()
CacheBlock::$cachePath
CacheBlock::$chmodDir = null
CacheBlock::$chmodFile = null
CacheBlock::$dirPrefix = 'block_'
CacheBlock::$dirTaggedPrefix = 'tagged_'
CacheBlock::$enabled = false [protected]
CacheBlock::$globalPrefix = ''

Global prefix to be used on all CacheBlock ids.

CacheBlock::$inst = null [static]
CacheBlock::$resetItemsCollection = null [protected]
CacheBlock::$wasCanceled = false

TRUE if any cache block was ever canceled.

const CacheBlock::PHP = 'php'
const CacheBlock::SERIALIZED = 'dat'
const CacheBlock::TEXT = 'txt'

The documentation for this class was generated from the following file: