## 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. */
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. class ezcCacheStorageApcOptions extends ezcBaseOptions
46. {
47. /**
48. * Parent storage options.
49. *
50. * @var ezcCacheStorageOptions
51. */
52. protected $storageOptions ;
54. /**
55. * Constructs an object with the specified values.
56. *
57. * @throws ezcBasePropertyNotFoundException
58. * If $options contains a property not defined.
59. * @throws ezcBaseValueException
60. * If $options contains a property with a value not allowed.
61. * @param array(string=>mixed) $options
62. */
63. public function __construct ( array $options = array() )
64. {
65. $this-> properties ['lockWaitTime'] = 200000;
66. $this-> properties ['maxLockTime'] = 5;
67. $this-> properties ['lockKey'] = '.ezcLock';
68. $this-> properties ['metaDataKey'] = '.ezcMetaData';
69. $this-> storageOptions = new ezcCacheStorageOptions ();
71. parent:: __construct ( $options );
72. }
74. /**
75. * Sets the option $name to $value.
76. *
77. * @throws ezcBasePropertyNotFoundException
78. * If the property $name is not defined.
79. * @throws ezcBaseValueException
80. * If $value is not correct for the property $name.
81. * @param string $name
82. * @param mixed $value
83. * @ignore
84. */
85. public function __set( $name, $value )
86. {
87. switch ( $name )
88. {
89. case 'lockWaitTime':
90. case 'maxLockTime':
91. if ( ! is_int ( $value ) || $value < 1 )
92. {
93. throw new ezcBaseValueException ( $name, $value, 'int > 0' );
94. }
95. break;
96. case 'lockKey':
97. case 'metaDataKey':
98. if ( ! is_string ( $value ) || strlen ( $value ) < 1 )
99. {
100. throw new ezcBaseValueException ( $name, $value, 'string, length > 0' );
101. }
102. break;
103. default:
104. // Delegate
105. $this-> storageOptions ->$name = $value;
106. }
107. $this-> properties [$name] = $value;
108. }
110. /**
111. * Returns the value of the option $name.
112. *
113. * @throws ezcBasePropertyNotFoundException
114. * If the property $name is not defined.
115. * @param string $name The name of the option to get
116. * @return mixed The option value
117. * @ignore
118. */
119. public function __get( $name )
120. {
121. if ( isset( $this-> properties [$name] ) )
122. {
123. return $this-> properties [$name];
124. }
126. // Delegate
127. return $this-> storageOptions ->$name;
128. }
130. /**
131. * Returns if option $name is defined.
132. *
133. * @param string $name Option name to check for
134. * @return bool
135. * @ignore
136. */
137. public function __isset( $name )
138. {
139. return ( isset( $this-> properties [$name] ) || isset( $this-> storageOptions ->$name ) );
140. }
142. /**
143. * Merge an ezcCacheStorageOptions object into this object.
144. *
145. * @param ezcCacheStorageOptions $options The options to merge.
146. * @return void
147. * @ignore
148. */
149. public function mergeStorageOptions( ezcCacheStorageOptions $options )
150. {
151. $this-> storageOptions = $options;
152. }
153. }
154. ?>

Documentation generated by phpDocumentor 1.4.3