Apache Zeta Components Manual :: File Source for storage_apc.php

Source for file storage_apc.php

Documentation is available at storage_apc.php

  1. <?php
  2. /**
  3.  * File containing the ezcCacheStorageApcOptions class.
  4.  *
  5.  * Licensed to the Apache Software Foundation (ASF) under one
  6.  * or more contributor license agreements.  See the NOTICE file
  7.  * distributed with this work for additional information
  8.  * regarding copyright ownership.  The ASF licenses this file
  9.  * to you under the Apache License, Version 2.0 (the
  10.  * "License"); you may not use this file except in compliance
  11.  * with the License.  You may obtain a copy of the License at
  12.  * 
  13.  *   http://www.apache.org/licenses/LICENSE-2.0
  14.  * 
  15.  * Unless required by applicable law or agreed to in writing,
  16.  * software distributed under the License is distributed on an
  17.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18.  * KIND, either express or implied.  See the License for the
  19.  * specific language governing permissions and limitations
  20.  * under the License.
  21.  *
  22.  * @package Cache
  23.  * @version //autogentag//
  24.  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  25.  * @filesource
  26.  */
  27.  
  28. /**
  29.  * Option class for defining a connection to APC.
  30.  *
  31.  * @property string $lockKey 
  32.  *            Cache key to use for locking. Default is '.ezcLock'.
  33.  * @property int $lockWaitTime 
  34.  *            Time to wait between lock availability checks. Measured in
  35.  *            microseconds ({@link usleep()}). Default is 200000.
  36.  * @property int $maxLockTime 
  37.  *            Time before a lock is considered dead, measured in seconds.
  38.  *            Default is 5.
  39.  * @property string $metaDataKey 
  40.  *            The name of the file used to store meta data. Default is
  41.  *            '.ezcMetaData'.
  42.  * @package Cache
  43.  * @version //autogentag//
  44.  */
  45. {
  46.     /**
  47.      * Parent storage options.
  48.      * 
  49.      * @var ezcCacheStorageOptions 
  50.      */
  51.     protected $storageOptions;
  52.  
  53.     /**
  54.      * Constructs an object with the specified values.
  55.      *
  56.      * @throws ezcBasePropertyNotFoundException
  57.      *          If $options contains a property not defined.
  58.      * @throws ezcBaseValueException
  59.      *          If $options contains a property with a value not allowed.
  60.      * @param array(string=>mixed) $options 
  61.      */
  62.     public function __constructarray $options array() )
  63.     {
  64.         $this->properties['lockWaitTime'200000;
  65.         $this->properties['maxLockTime']  5;
  66.         $this->properties['lockKey']      '.ezcLock';
  67.         $this->properties['metaDataKey']  '.ezcMetaData';
  68.         $this->storageOptions = new ezcCacheStorageOptions();
  69.  
  70.         parent::__construct$options );
  71.     }
  72.  
  73.     /**
  74.      * Sets the option $name to $value.
  75.      *
  76.      * @throws ezcBasePropertyNotFoundException
  77.      *          If the property $name is not defined.
  78.      * @throws ezcBaseValueException
  79.      *          If $value is not correct for the property $name.
  80.      * @param string $name 
  81.      * @param mixed $value 
  82.      * @ignore
  83.      */
  84.     public function __set$name$value )
  85.     {
  86.         switch $name )
  87.         {
  88.             case 'lockWaitTime':
  89.             case 'maxLockTime':
  90.                 if !is_int$value || $value )
  91.                 {
  92.                     throw new ezcBaseValueException$name$value'int > 0' );
  93.                 }
  94.                 break;
  95.             case 'lockKey':
  96.             case 'metaDataKey':
  97.                 if !is_string$value || strlen$value )
  98.                 {
  99.                     throw new ezcBaseValueException$name$value'string, length > 0' );
  100.                 }
  101.                 break;
  102.             default:
  103.                 // Delegate
  104.                 $this->storageOptions->$name $value;
  105.         }
  106.         $this->properties[$name$value;
  107.     }
  108.  
  109.     /**
  110.      * Returns the value of the option $name.
  111.      * 
  112.      * @throws ezcBasePropertyNotFoundException
  113.      *          If the property $name is not defined.
  114.      * @param string $name The name of the option to get
  115.      * @return mixed The option value
  116.      * @ignore
  117.      */
  118.     public function __get$name )
  119.     {
  120.         if isset$this->properties[$name) )
  121.         {
  122.             return $this->properties[$name];
  123.         }
  124.  
  125.         // Delegate
  126.         return $this->storageOptions->$name;
  127.     }
  128.  
  129.     /**
  130.      * Returns if option $name is defined.
  131.      * 
  132.      * @param string $name Option name to check for
  133.      * @return bool 
  134.      * @ignore
  135.      */
  136.     public function __isset$name )
  137.     {
  138.         return isset$this->properties[$name|| isset$this->storageOptions->$name ) );
  139.     }
  140.  
  141.     /**
  142.      * Merge an ezcCacheStorageOptions object into this object.
  143.      * 
  144.      * @param ezcCacheStorageOptions $options The options to merge.
  145.      * @return void 
  146.      * @ignore
  147.      */
  148.     public function mergeStorageOptionsezcCacheStorageOptions $options )
  149.     {
  150.         $this->storageOptions = $options;
  151.     }
  152. }
  153. ?>
Documentation generated by phpDocumentor 1.4.3