|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Memory |
|
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
19 * @version $Id: Locked.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
20 */ |
|
21 |
|
22 /** Zend_Memory_Container */ |
|
23 require_once 'Zend/Memory/Container.php'; |
|
24 |
|
25 /** |
|
26 * Memory value container |
|
27 * |
|
28 * Locked (always stored in memory). |
|
29 * |
|
30 * @category Zend |
|
31 * @package Zend_Memory |
|
32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
34 */ |
|
35 class Zend_Memory_Container_Locked extends Zend_Memory_Container |
|
36 { |
|
37 /** |
|
38 * Value object |
|
39 * |
|
40 * @var string |
|
41 */ |
|
42 public $value; |
|
43 |
|
44 |
|
45 /** |
|
46 * Object constructor |
|
47 * |
|
48 * @param Zend_Memory_Manager $memoryManager |
|
49 * @param integer $id |
|
50 * @param string $value |
|
51 */ |
|
52 public function __construct($value) |
|
53 { |
|
54 $this->value = $value; |
|
55 } |
|
56 |
|
57 /** |
|
58 * Lock object in memory. |
|
59 */ |
|
60 public function lock() |
|
61 { |
|
62 /* Do nothing */ |
|
63 } |
|
64 |
|
65 /** |
|
66 * Unlock object |
|
67 */ |
|
68 public function unlock() |
|
69 { |
|
70 /* Do nothing */ |
|
71 } |
|
72 |
|
73 /** |
|
74 * Return true if object is locked |
|
75 * |
|
76 * @return boolean |
|
77 */ |
|
78 public function isLocked() |
|
79 { |
|
80 return true; |
|
81 } |
|
82 |
|
83 /** |
|
84 * Get string value reference |
|
85 * |
|
86 * _Must_ be used for value access before PHP v 5.2 |
|
87 * or _may_ be used for performance considerations |
|
88 * |
|
89 * @return &string |
|
90 */ |
|
91 public function &getRef() |
|
92 { |
|
93 return $this->value; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Signal, that value is updated by external code. |
|
98 * |
|
99 * Should be used together with getRef() |
|
100 */ |
|
101 public function touch() |
|
102 { |
|
103 /* Do nothing */ |
|
104 } |
|
105 |
|
106 /** |
|
107 * Destroy memory container and remove it from memory manager list |
|
108 */ |
|
109 public function destroy() |
|
110 { |
|
111 /* Do nothing */ |
|
112 } |
|
113 } |