forked from guilhermeblanco/zendframework1-doctrine2
-
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.
- Loading branch information
1 parent
109650e
commit 8e1c64b
Showing
7 changed files
with
382 additions
and
197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ignore eclipse files | ||
.settings | ||
.buildpath | ||
|
||
# ignore third party libs | ||
vendor | ||
|
||
# ignore the composer lock file | ||
composer.lock | ||
|
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,23 @@ | ||
<?php | ||
|
||
namespace Bisna\Common\Cache; | ||
|
||
use Cache\Adapter\PHPArray\ArrayCachePool; | ||
|
||
class ArrayCache extends ArrayCachePool | ||
{ | ||
private string $_namespace; | ||
public function __construct(array $options) | ||
{ | ||
$limit = $options['limit'] ?? null; | ||
parent::__construct($limit); | ||
} | ||
|
||
public function setNamespace($namespace) { | ||
$this->_namespace = $namespace; | ||
} | ||
|
||
public function getNamespace() { | ||
return $this->_namespace; | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace Bisna\Common\Cache; | ||
|
||
use Cache\Adapter\Filesystem\FilesystemCachePool; | ||
use League\Flysystem\Adapter\Local; | ||
use League\Flysystem\Filesystem; | ||
use League\Flysystem\FilesystemInterface; | ||
|
||
class FilesystemCache extends FilesystemCachePool | ||
{ | ||
private string $_namespace; | ||
|
||
public function __construct(array $options) | ||
{ | ||
$filesystemRoot = $options['directory']; | ||
$filesystemAdapter = new Local($filesystemRoot); | ||
$filesystem = new Filesystem($filesystemAdapter); | ||
parent::__construct($filesystem); | ||
} | ||
|
||
public function setNamespace($namespace) { | ||
$this->_namespace = $namespace; | ||
} | ||
|
||
public function getNamespace() { | ||
return $this->_namespace; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace Bisna\Common\Cache; | ||
|
||
use Cache\Adapter\Memcached\MemcachedCachePool; | ||
|
||
class MemcacheCache extends MemcachedCachePool { | ||
|
||
private string $_namespace; | ||
|
||
public function __construct(array $options) { | ||
$cache = new \Memcached(); | ||
foreach ($options['servers'] as $server) { | ||
$host = $server['host'] ?? 'localhost'; | ||
$port = $server['port'] ?? 11211; | ||
$cache->addServer($host, $port); | ||
} | ||
parent::__construct($cache); | ||
} | ||
|
||
public function setNamespace($namespace) { | ||
$this->_namespace = $namespace; | ||
} | ||
|
||
public function getNamespace() { | ||
return $this->_namespace; | ||
} | ||
} |
Oops, something went wrong.