Cache
[ class tree: Cache ] [ index: Cache ] [ all elements ]

Class: Cache_Container_shm

Source Location: /Cache-1.5.7/Cache/Container/shm.php

Class Overview

Cache_Container
   |
   --Cache_Container_shm

Stores cache data into shared memory.


Author(s):

Version:

  • $Id: shm.php 316194 2011-09-05 20:35:25Z cweiske $

Variables

Methods


Inherited Variables

Inherited Methods

Class: Cache_Container

Cache_Container::decode()
Decodes the data from the storage container.
Cache_Container::encode()
Encodes the data for the storage container.
Cache_Container::fetch()
Fetches a dataset from the storage medium.
Cache_Container::flush()
Flushes the cache - removes all caches datasets from the cache.
Cache_Container::flushPreload()
Flushes the internal preload buffer.
Cache_Container::garbageCollection()
Starts the garbage collection.
Cache_Container::getAllowedOptions()
Getter to allowed Configurations Options
Cache_Container::getExpiresAbsolute()
Translates human readable/relative times in unixtime
Cache_Container::getUserdata()
Returns the userdata field of a cached data set.
Cache_Container::hasBeenSet()
Verify that a configuration option has been set
Cache_Container::idExists()
Checks if a dataset exists.
Cache_Container::isCached()
Checks if a dataset is cached.
Cache_Container::isExpired()
Checks if a dataset is expired.
Cache_Container::load()
Loads a dataset from the cache.
Cache_Container::preload()
Does a speculative preload of a dataset
Cache_Container::remove()
Removes a dataset.
Cache_Container::save()
Stores a dataset.
Cache_Container::setAllowedOptions()
Set the Allowed Parameters to Container Type
Cache_Container::setOptions()
Imports the requested datafields as object variables if allowed

Class Details

[line 35]
Stores cache data into shared memory.

Well, this is not a very efficient implementation. Indeed it's much slower than the file container as far as my tests showed. Files are cached by most operating systems and it will be hard to write a faster caching algorithm using PHP.

  • Author: Ulf Wendel <ulf.wendel@phpdoc.de>
  • Version: $Id: shm.php 316194 2011-09-05 20:35:25Z cweiske $


[ Top ]


Class Variables

$entries = array()

[line 95]

Hash of cache entries

Used by the garbage collection to find old entries.


Type:   array


[ Top ]

$sem_id =  null

[line 56]

Semaphore handler

Type:   resource


[ Top ]

$sem_key =  null

[line 42]

Key of the semaphore used to sync the SHM access

Type:   int


[ Top ]

$sem_perm =  0644

[line 49]

Permissions of the semaphore used to sync the SHM access

Type:   int


[ Top ]

$shm_id =  null

[line 86]

Shared memory handler

Type:   resource


[ Top ]

$shm_key =  null

[line 63]

Key of the shared memory block used to store cache data

Type:   int


[ Top ]

$shm_perm =  0644

[line 79]

Permissions of the shared memory block

Type:   int


[ Top ]

$shm_size =  131072

[line 72]

Size of the shared memory block used

Note: the container does only use _one_ shm block no more!


Type:   int


[ Top ]

$total_size =  0

[line 102]

Number of bytes consumed by the cache

Type:   int


[ Top ]



Method Detail

Cache_Container_shm (Constructor)   [line 109]

Cache_Container_shm Cache_Container_shm( [array $options = null])

Creates a shared memory container

Parameters:

array   $options     shm_key, sem_key, shm_size, sem_perm, shm_perm

[ Top ]

doGarbageCollection   [line 257]

void doGarbageCollection( $maxlifetime, &$cachedata)


Parameters:

   $maxlifetime     
   &$cachedata     

[ Top ]

fetch   [line 145]

void fetch( $id, $group)


Overrides Cache_Container::fetch() (Fetches a dataset from the storage medium.)

Parameters:

   $id     
   $group     

[ Top ]

flush   [line 202]

void flush( [ $group = ''])


Overrides Cache_Container::flush() (Flushes the cache - removes all caches datasets from the cache.)

Parameters:

   $group     

[ Top ]

garbageCollection   [line 226]

void garbageCollection( $maxlifetime, [ $cachedata = array()])


Overrides Cache_Container::garbageCollection() (Starts the garbage collection.)

Parameters:

   $maxlifetime     
   $cachedata     

[ Top ]

idExists   [line 213]

void idExists( $id, $group)


Overrides Cache_Container::idExists() (Checks if a dataset exists.)

Parameters:

   $id     
   $group     

[ Top ]

remove   [line 189]

void remove( $id, $group)


Overrides Cache_Container::remove() (Removes a dataset.)

Parameters:

   $id     
   $group     

[ Top ]

save   [line 166]

void save( $id, $data, $expire, $group, $userdata)


Overrides Cache_Container::save() (Stores a dataset.)

Parameters:

   $id     
   $data     
   $expire     
   $group     
   $userdata     

[ Top ]


Documentation generated on Thu, 15 Sep 2011 07:00:07 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.