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

Source for file storage.php

Documentation is available at storage.php

  1. <?php
  2. /**
  3.  * File containing the ezcCacheStorageOptions 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 the ezcCacheStorage class.
  30.  * Instances of this class store the options of ezcCacheStorage
  31.  * implementations.
  32.  *
  33.  * @property int    $ttl       The time to live of cache entries.
  34.  * @property string $extension The (file) extension to use for the storage items.
  35.  *
  36.  * @package Cache
  37.  * @version //autogentag//
  38.  */
  39. {
  40.     /**
  41.      * Constructs a new options object.
  42.      *
  43.      * It also sets the default values of the format property
  44.      *
  45.      * @param array(string=>mixed) $options The initial options to set.
  46.      *
  47.      * @throws ezcBasePropertyNotFoundException
  48.      *          If trying to assign a property which does not exist
  49.      * @throws ezcBaseValueException
  50.      *          If the value for the property is incorrect
  51.      */
  52.     public function __construct$options array() )
  53.     {
  54.         $this->properties['ttl'86400;
  55.         $this->properties['extension''.cache';
  56.         parent::__construct$options );
  57.     }
  58.  
  59.     /**
  60.      * Sets an option.
  61.      * This method is called when an option is set.
  62.      * 
  63.      * @param string $key  The option name.
  64.      * @param mixed $value The option value.
  65.      * @ignore
  66.      */
  67.     public function __set$key$value )
  68.     {
  69.         switch $key )
  70.         {
  71.             case "extension":
  72.                 if !is_string$value || strlen$value )
  73.                 {
  74.                     throw new ezcBaseValueException$key$value"string, size > 0" );
  75.                 }
  76.                 break;
  77.             case "ttl":
  78.                 if !is_int$value && $value !== false )
  79.                 {
  80.                     throw new ezcBaseValueException$key$value"int > 0 or false" );
  81.                 }
  82.                 break;
  83.             default:
  84.                 throw new ezcBasePropertyNotFoundException$key );
  85.         }
  86.         $this->properties[$key$value;
  87.     }
  88. }
  89.  
  90.  
  91. ?>
Documentation generated by phpDocumentor 1.4.3