PageRenderTime 26ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/framework/vendor/zend/Zend/Memory/Container/Locked.php

http://zoop.googlecode.com/
PHP | 113 lines | 30 code | 10 blank | 73 comment | 0 complexity | 311fd936e95e2385cf1011d314378395 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1
  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. /** Zend_Memory_Container */
  22. require_once 'Zend/Memory/Container.php';
  23. /**
  24. * Memory value container
  25. *
  26. * Locked (always stored in memory).
  27. *
  28. * @category Zend
  29. * @package Zend_Memory
  30. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. */
  33. class Zend_Memory_Container_Locked extends Zend_Memory_Container
  34. {
  35. /**
  36. * Value object
  37. *
  38. * @var string
  39. */
  40. public $value;
  41. /**
  42. * Object constructor
  43. *
  44. * @param Zend_Memory_Manager $memoryManager
  45. * @param integer $id
  46. * @param string $value
  47. */
  48. public function __construct($value)
  49. {
  50. $this->value = $value;
  51. }
  52. /**
  53. * Lock object in memory.
  54. */
  55. public function lock()
  56. {
  57. /* Do nothing */
  58. }
  59. /**
  60. * Unlock object
  61. */
  62. public function unlock()
  63. {
  64. /* Do nothing */
  65. }
  66. /**
  67. * Return true if object is locked
  68. *
  69. * @return boolean
  70. */
  71. public function isLocked()
  72. {
  73. return true;
  74. }
  75. /**
  76. * Get string value reference
  77. *
  78. * _Must_ be used for value access before PHP v 5.2
  79. * or _may_ be used for performance considerations
  80. *
  81. * @return &string
  82. */
  83. public function &getRef()
  84. {
  85. return $this->value;
  86. }
  87. /**
  88. * Signal, that value is updated by external code.
  89. *
  90. * Should be used together with getRef()
  91. */
  92. public function touch()
  93. {
  94. /* Do nothing */
  95. }
  96. /**
  97. * Destroy memory container and remove it from memory manager list
  98. */
  99. public function destroy()
  100. {
  101. /* Do nothing */
  102. }
  103. }