Class FTCache_Strategy

(line 214)

Description


Located in File: /FTCache.php

Describes the functions that we will need to implement to provide a mapping between the objects ID and the ID used in the cache.

NOTE: calling fromCache(toCache($some_id)) will not necessarily return $some_id! This is because toCache is used to map both already cached id's and not yet cached ids while fromCache is used to only return the id of already cached entries.



Classes extended from FTCache_Strategy:
FTCache_Strategy_DirectMapping
Implements a Direct Mapping strategy between the given object id and the cache index id by doing a modulus using the size of the cache.

Class Variables

Summary:
int $_size

$_size = 0 (line 220)

Data type : int

Size of the schema, used for the modulus
  • access: - protected

Class Constants

Summary:

Method Detail

Summary:
FTCache_Strategy __construct (int $size)
int fromCache (int $index)
void stored (int $id)
int toCache (int $id)

Constructor __construct (line 227)

FTCache_Strategy __construct( int $size)

Sets the size of the cache.

Parameters

  • int $size: Size of the cache

Info

  • access - public

Method fromCache (line 245)

int fromCache( int $index)

Overridden in child classes as:

FTCache_Strategy_DirectMapping::fromCache()
Convert a cache entry index into an object id

Convert a cache entry index into an object id

This method must return the object id of the cache entry stored at the given index. If there is nothing stored there, then it must return false.

Parameters

  • int $index: Cache entry index

Info

  • return - Object Id. False if we can't map that index or nothing is stored there.
  • abstract -
  • access - public

Method stored (line 253)

void stored( int $id)

Overridden in child classes as:

FTCache_Strategy_DirectMapping::stored()
Whenever the cache will store an object in the container, it informs this strategy object by calling this method.

Whenever the cache will store an object in the container, it informs this strategy object by calling this method.

Parameters

  • int $id: Object id

Info

  • abstract -
  • access - public

Method toCache (line 264)

int toCache( int $id)

Overridden in child classes as:

FTCache_Strategy_DirectMapping::toCache()
Convert an object ID into a cache entry index.

Convert an object ID into a cache entry index.

This method must return the index that the given object id is stored at if it is currently stored, or the index that it will be stored at if it is not already stored.

Parameters

  • int $id: Object ID

Info

  • return - Cache Index. False if we can't / won't map that index
  • abstract -
  • access - public

Inherited Variables

Inherited Class Variable Summary

Inherited Methods

Inherited Method Summary


Documentation generated on Sat, 01 Mar 2008 03:16:45 +0000 by phpDocumentor 1.4.0