Author: dr
Date: Tue Aug 14 13:54:19 2007
New Revision: 5914

Log:
- Fixed docs.

Added:
    trunk/Cache/docs/tutorial_lazy_initialization.php   (with props)
Modified:
    trunk/Cache/src/manager.php

Added: trunk/Cache/docs/tutorial_lazy_initialization.php
==============================================================================
--- trunk/Cache/docs/tutorial_lazy_initialization.php (added)
+++ trunk/Cache/docs/tutorial_lazy_initialization.php [iso-8859-1] Tue Aug 14 
13:54:19 2007
@@ -1,0 +1,44 @@
+<?php
+
+require_once 'tutorial_autoload.php';
+
+class customLazyCacheConfiguration implements ezcBaseConfigurationInitializer
+{
+    public static function configureObject( $id )
+    {
+        $options = array( 'ttl' => 30 );
+        
+        switch ( $id )
+        {
+            case 'simple':
+                ezccCacheManager::createCache( 'simple', '/tmp/cache/plain', 
'ezcCacheStorageFilePlain', $options );
+                break;
+        }
+    }
+}
+
+ezcBaseInit::setCallback( 
+    'ezcInitConfigurationManager', 
+    'customLazyCacheConfiguration'
+);
+
+$myId = 'unique_id_1';
+$mySecondId = 'id_2';
+
+$cache = ezcCacheManager::getCache( 'simple' );
+
+if ( ( $dataOfFirstItem = $cache->restore( $myId ) ) === false )
+{
+    $dataOfFirstItem = "Plain cache stored on " . date( 'Y-m-d, H:i:s' );
+    $cache->store( $myId, $dataOfFirstItem );
+}
+
+if ( ( $dataOfSecondItem = $cache->restore( $mySecondId ) ) === false )
+{
+    $dataOfSecondItem = "Plain cache 2 stored on " . date( 'Y-m-d, H:i:s' );
+    $cache->store( $mySecondId, $dataOfSecondItem );
+}
+
+var_dump( $dataOfFirstItem, $dataOfSecondItem );
+
+?>

Propchange: trunk/Cache/docs/tutorial_lazy_initialization.php
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/Cache/src/manager.php
==============================================================================
--- trunk/Cache/src/manager.php [iso-8859-1] (original)
+++ trunk/Cache/src/manager.php [iso-8859-1] Tue Aug 14 13:54:19 2007
@@ -57,9 +57,10 @@
  * // instance will be reused.
  * $cache = ezcCacheManager::getCache( 'content' );
  *
- * Instead of using the createCache()/getCache() mechanism you can also create
- * cache on-demand with delayed initialization. You can find information on how
- * to use that in the [EMAIL PROTECTED] ../introduction_Cache.html tutorial}.
+ * // Instead of using the createCache()/getCache() mechanism you can also
+ * // create cache on-demand with delayed initialization. You can find
+ * // information on how to use that in the
+ * // [EMAIL PROTECTED] ../introduction_Cache.html tutorial}.
  *
  * // Specify any number of attributes to identify the cache item you want
  * // to store. This attributes can be used later to perform operations


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to