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

Source for file storage_configuration.php

Documentation is available at storage_configuration.php

  1. <?php
  2. /**
  3.  * File containing the ezcCacheStackStorageConfiguration 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.  * ezcCacheStackStorageConfiguration
  30.  *
  31.  * Configuration for a {@link ezcCacheStackableStorage} inside an {@link }
  32.  * ezcCacheStack}. The configuration consists of a string $id that identifies
  33.  * the $storage uniquely inside the stack. The $itemLimit is the maximum number
  34.  * of items that might be stored in the $storage at once. This number is
  35.  * determined by the used {@link ezcCacheStackMetaData} used in the stack. The
  36.  * $freeRate is the fraction of $itemLimit that will be freed by the used
  37.  * {@link ezcCacheStackReplacementStrategy} when the storage runs full.
  38.  *
  39.  * @property-read string $id 
  40.  *                 The unique ID of the configured storage in the stack.
  41.  * @property-read ezcCacheStackableStorage $storage 
  42.  *                 The storage that is configured with this configuration. A
  43.  *                 storage might only be part of 1 stack and this only once.
  44.  * @property-read int $itemLimit 
  45.  *                 Maximum number of items to be stored in $storage.
  46.  * @property-read float $freeRate 
  47.  *                 Fraction of $itemLimit that is freed if $storage runs full.
  48.  * @package Cache
  49.  * @version //autogen//
  50.  */
  51. {
  52.     /**
  53.      * Properties
  54.      * 
  55.      * @var array(string=>mixed) 
  56.      */
  57.     protected $properties = array(
  58.         'id'        => null,
  59.         'storage'   => null,
  60.         'itemLimit' => null,
  61.         'freeRate'  => null,
  62.     );
  63.  
  64.     /**
  65.      * Creates a new storage configuration.
  66.      *
  67.      * This method creates an new configuration with the given values. Note
  68.      * that, once set, these values cannot be changed anymore to avoid
  69.      * inconsistencies in the stack. For details about the parameters, please
  70.      * refer to the properties documentation of this class.
  71.      *
  72.      * Note that the properties can only be set once, using this constructore,
  73.      * and are not changeable via property access.
  74.      * 
  75.      * @param string $id 
  76.      * @param ezcCacheStackableStorage $storage 
  77.      * @param int $itemLimit 
  78.      * @param float $freeRate 
  79.      *
  80.      * @throws ezcBaseValueException
  81.      *          if a given value does not conform to the indicated format.
  82.      */
  83.     public function __construct$idezcCacheStackableStorage $storage$itemLimit$freeRate )
  84.     {
  85.         if !is_string$id || strlen$id )
  86.         {
  87.             throw new ezcBaseValueException(
  88.                 'id'$id'string, length > 0'
  89.             );
  90.         }
  91.         if !is_int$itemLimit || $itemLimit )
  92.         {
  93.             throw new ezcBaseValueException(
  94.                 'itemLimit'$itemLimit'int > 1'
  95.             );
  96.         }
  97.         if !is_numeric$freeRate ||  $freeRate <= || $freeRate )
  98.         {
  99.             throw new ezcBaseValueException(
  100.                 'freeRate'$freeRate'float > 0 and <= 1'
  101.             );
  102.         }
  103.         $this->properties['id']        $id;
  104.         $this->properties['storage']   $storage;
  105.         $this->properties['itemLimit'$itemLimit;
  106.         $this->properties['freeRate']  $freeRate;
  107.     }
  108.  
  109.     /**
  110.      * Returns the value of a property.
  111.      * 
  112.      * @param string $propertyName 
  113.      * @return mixed 
  114.      * @ignore
  115.      */
  116.     public function __get$propertyName )
  117.     {
  118.         if $this->__isset$propertyName ) )
  119.         {
  120.             return $this->properties[$propertyName];
  121.         }
  122.         throw new ezcBasePropertyNotFoundException$propertyName );
  123.     }
  124.  
  125.     /**
  126.      * Returns if a property exists.
  127.      * 
  128.      * @param string $propertyName 
  129.      * @return bool 
  130.      * @ignore
  131.      */
  132.     public function __isset$propertyName )
  133.     {
  134.         return array_key_exists$propertyName$this->properties );
  135.     }
  136.  
  137.     /**
  138.      * Sets a property.
  139.      * 
  140.      * @param string $propertyName 
  141.      * @param mixed $propertyValue 
  142.      * @ignore
  143.      */
  144.     public function __set$propertyName$propertyValue )
  145.     {
  146.         if $this->__isset$propertyName ) )
  147.         {
  148.             throw new ezcBasePropertyPermissionException(
  149.                 $propertyName,
  150.                 ezcBasePropertyPermissionException::READ
  151.             );
  152.         }
  153.         throw new ezcBasePropertyNotFoundException$propertyName );
  154.     }
  155. }
  156.  
  157. ?>
Documentation generated by phpDocumentor 1.4.3