Open Source Content Management System

mRFC 0031: MidgardApacheCache

  1. Revision history
  2. Background
  3. Implementation
      1. Example
      2. Example

MidgardApacheCache

Revision history

  • 2006-06-14 Created by Piotr Pokora

Background

Cache approaches:

  • data reusability
  • limit the need to query the same objects with every request
  • cache objects which are queried with the same data with every request

Implementation

MidgardApacheCache should extend base MidgardCache class, and should be optimized for any midgard extension which is used in Apache module environment. MidgardCache base class should be assigned as private member of MidgardConnection and thus connection handler object could be responsible for managing internal's core objects references counts.

MidgardApacheCache when instanciated should return UUID which should be available during the whole application runtime. For Apache module, it means - as long as httpd server is running.

There shouldn't be any method or function in implementation which should allow list all cache entries ( MidgardApacheCache instances ) available.

Retrieving MidgardApacheCache instance should be possible only with UUID representing particular object instance and application which use cache object should be responsible to store this UUID.

Example

<?php

$application_cache_guid = "guid_string"; 

$cache = new midgard_apache_cache($application_cache_guid);
if(!$cache->exists())
    $application_cache_guid = $cache->create();
else 
    $cache->get();
?>

The main purpose of MidgardApacheCache should be possibility to store objects , however other types should be supported as well. Objects should be identified by guids in the same way as are identified and retrieved in typical Midgard applications. Other types like arrays should be registered with unique names.

Example

<?php

$object = $cache->get_type_by_guid("object_guid_string");
$object->register("my_constant_array", $array_type);
$array = $object->get_type_by_name("my_constant_array");

?>

MidgardApacheCache should implement such features:

  • initialize cache
  • get cache object instance identified by UUID
  • add type to cache
  • update type in cache
  • get type from cache
  • remove type from cache

Back

Designed by Nemein, hosted by Anykey