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

Source for file plain.php

Documentation is available at plain.php

  1. <?php
  2. /**
  3.  * File containing the ezcCacheStorageMemcachePlain 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.  * This storage implementation stores data in a Memcache cache.
  30.  *
  31.  * @package Cache
  32.  * @version //autogentag//
  33.  */
  34. {
  35.     /**
  36.      * Fetches data from the cache.
  37.      *
  38.      * @param string $identifier The file to fetch data from
  39.      * @param bool $object Return the object and not the clean data
  40.      * @return mixed The fetched data or false on failure
  41.      */
  42.     protected function fetchData$identifier$object false )
  43.     {
  44.         // @TODO: This is also done in the backend, again. However, since the
  45.         // backend is public, too, we need to keep both for now.
  46.         $data $this->backend->fetch$identifier );
  47.         if is_object$data && $object === false )
  48.         {
  49.             return $data->data;
  50.         }
  51.         if is_object$data && $object !== false )
  52.         {
  53.             return $data;
  54.         }
  55.         else
  56.         {
  57.             return false;
  58.         }
  59.     }
  60.  
  61.     /**
  62.      * Wraps the data in an ezcCacheStorageMemoryDataStruct structure in order
  63.      * to store it.
  64.      *
  65.      * @throws ezcCacheInvalidDataException
  66.      *          If the data submitted can not be handled by this storage (resource).
  67.      *
  68.      * @param mixed $data Simple type or array
  69.      * @return ezcCacheStorageMemoryDataStruct Prepared data
  70.      */
  71.     protected function prepareData$data )
  72.     {
  73.         if is_resource$data ) )
  74.         {
  75.             throw new ezcCacheInvalidDataExceptiongettype$data )array'simple''array''object' ) );
  76.         }
  77.         return new ezcCacheStorageMemoryDataStruct$data$this->properties['location');
  78.     }
  79. }
  80. ?>
Documentation generated by phpDocumentor 1.4.3