Skip to content

Commit 92a7d1a

Browse files
committed
Added SHM::__invoke() as a shortcut to SHM::add();
Minor fixes to the PHAR stub; Release notes.
1 parent 08c79ad commit 92a7d1a

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed

RELEASE-0.1.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
First PEAR2 compatible release.

RELEASE-0.1.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* Fixed the PHAR stub.
2+
* Removed the warnings APC would trigger when using SHM::factory().
3+
* Allowed registering of external adapters with the new SHM::registerAdapter() method.
4+
* Added SHM::__invoke() as a shortcut to SHM::add().

package.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,25 @@
1111
<email>[email protected]</email>
1212
<active>yes</active>
1313
</lead>
14-
<date>2012-08-03</date>
15-
<time>00:53:00</time>
14+
<date>2012-09-25</date>
15+
<time>23:15:45</time>
1616
<version>
17-
<release>0.1.0</release>
17+
<release>0.1.1</release>
1818
<api>0.1.0</api>
1919
</version>
2020
<stability>
2121
<release>alpha</release>
2222
<api>alpha</api>
2323
</stability>
2424
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL License 2.1</license>
25-
<notes>First PEAR2 compatible release.</notes>
25+
<notes>* Fixed the PHAR stub.
26+
* Removed the warnings APC would trigger when using SHM::factory().
27+
* Allowed registering of external adapters with the new SHM::registerAdapter() method.
28+
* Added SHM::__invoke() as a shortcut to SHM::add().</notes>
2629
<contents>
2730
<dir name="/">
2831
<dir name="docs" baseinstalldir="/">
32+
<file role="doc" name="apigen.neon"/>
2933
<file role="doc" name="doxygen.ini">
3034
<tasks:replace from="../src" to="php_dir" type="pear-config"/>
3135
<tasks:replace from="GIT: $Id$" to="version" type="package-info"/>

src/PEAR2/Cache/SHM.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ public static function registerAdapter($adapter, $prepend = false)
8787
&& $adapter::isMeetingRequirements()
8888
) {
8989
if ($prepend) {
90-
self::$_adapters = array_merge(array($adapter), self::$_adapters);
90+
self::$_adapters = array_merge(
91+
array($adapter), self::$_adapters
92+
);
9193
} else {
9294
self::$_adapters[] = $adapter;
9395
}
@@ -96,6 +98,23 @@ public static function registerAdapter($adapter, $prepend = false)
9698
return false;
9799
}
98100

101+
/**
102+
* Adds a value to the shared memory storage.
103+
*
104+
* Adds a value to the storage if it doesn't exist, or fails if it does.
105+
*
106+
* @param string $key Name of key to associate the value with.
107+
* @param mixed $value Value for the specified key.
108+
* @param int $ttl Seconds to store the value. If set to 0 indicates no
109+
* time limit.
110+
*
111+
* @return bool TRUE on success, FALSE on failure.
112+
*/
113+
public function __invoke($key, $value, $ttl = 0)
114+
{
115+
return $this->add($key, $value, $ttl);
116+
}
117+
99118
/**
100119
* Gets a value from the shared memory storage.
101120
*

stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
if ($isHttp) {
1010
header('Content-Type: text/plain;charset=UTF-8');
1111
}
12-
echo "PEAR2_Cache_SHM @PACKAGE_VERSION@\n";
12+
echo "@PACKAGE_NAME@ @PACKAGE_VERSION@\n";
1313

1414
if (version_compare(phpversion(), '5.3.0', '<')) {
1515
echo "\nThis package requires PHP 5.3.0 or later.";

0 commit comments

Comments
 (0)