-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from emonkak/develop
Fix an optional argument handing
- Loading branch information
Showing
28 changed files
with
544 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Emonkak\Di\Benchmarks\Fixtures; | ||
|
||
interface FooInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
apc.enabled=1 | ||
apc.enable_cli=1 | ||
apcu.enabled=1 | ||
apcu.enable_cli=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace Emonkak\Di\Cache; | ||
|
||
/** | ||
* Provides the cache from APCu. | ||
*/ | ||
class ApcuCache implements \ArrayAccess | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $prefix; | ||
|
||
/** | ||
* @var integer | ||
*/ | ||
private $lifetime; | ||
|
||
/** | ||
* @param string $prefix The string to be prepended to a key. | ||
* @param integer $lifetime The time until a cache expiration. | ||
*/ | ||
public function __construct($prefix = '', $lifetime = 0) | ||
{ | ||
$this->prefix = $prefix; | ||
$this->lifetime = $lifetime; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function offsetGet($offset) | ||
{ | ||
return apcu_fetch($this->prefix . $offset); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function offsetExists($offset) | ||
{ | ||
return apcu_exists($this->prefix . $offset); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function offsetSet($offset, $value) | ||
{ | ||
apcu_store($this->prefix . $offset, $value, $this->lifetime); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function offsetUnset($offset) | ||
{ | ||
apcu_delete($this->prefix . $offset); | ||
} | ||
} |
Oops, something went wrong.