## 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 ezcCacheStorageApcPlain 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. */
28. /**
29. * This storage implementation stores data in an APC cache.
30. *
31. * This storage can also be used with {@link ezcCacheStack}. However, APC
32. * version 3.0.16 or newer is required for that.
33. *
34. * @package Cache
35. * @version //autogentag//
36. */
37. class ezcCacheStorageApcPlain extends ezcCacheStorageApc
38. {
39. /**
40. * Fetches data from the cache.
41. *
42. * @param string $identifier The file to fetch data from
43. * @param bool $object return the object and not the clean data
44. * @return mixed The fetched data or false on failure
45. */
46. protected function fetchData ( $identifier, $object = false )
47. {
48. $data = $this-> backend ->fetch( $identifier );
49. if ( is_object ( $data ) && $object === false )
50. {
51. return $data->data;
52. }
53. if ( is_object ( $data ) && $object !== false )
54. {
55. return $data;
56. }
57. else
58. {
59. return false;
60. }
61. }
63. /**
64. * Wraps the data in an ezcCacheStorageMemoryDataStruct structure in order
65. * to store it.
66. *
67. * @throws ezcCacheInvalidDataException
68. * If the data submitted can not be handled by this storage (resource).
69. *
70. * @param mixed $data Simple type or array
71. * @return ezcCacheStorageMemoryDataStruct Prepared data
72. */
73. protected function prepareData ( $data )
74. {
75. if ( is_resource ( $data ) )
76. {
77. throw new ezcCacheInvalidDataException ( gettype ( $data ), array( 'simple', 'array', 'object' ) );
78. }
79. return new ezcCacheStorageMemoryDataStruct ( $data, $this-> properties ['location'] );
80. }
81. }
82. ?>

Documentation generated by phpDocumentor 1.4.3