zendframework / zend-cache Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 3-Clause "New" or "Revised" License
License: BSD 3-Clause "New" or "Revised" License
Due to zendframework/zend-json#23, Zend\Serializer\Exception
will be thrown when cache miss on PHP7 if using Zend\Cache\Storage\Plugin\Serializer
with Zend\Serializer\Adapter\Json
.
TLDR; Cast your eye over the documetation for any problems not covered in the other issues
Things slip through the net, so check the documentation for other problems that have been missed. Common other problems include
*
then space at the start of line)bookdown.json
file is correctly formated and has the right escapingIf you end up fixing the same problem over and over, please ping Gary Hockin - we may be able to add bespoke issue for that problem, or fix in automated capacity
Has anyone done any work on a PSR-6 wrapper for zend-cache? I know the PSR still in review, but it would be darn handy...
TLDR; Headers should use the
#
,##
etc to format different levels of headers, and not be underlines using=====
or ``-----`, or be psuedo header using bold
Check all headers on the documentation - headers should use the hash style of declaration rather then be underlined with equals or dashes. The more hashes, the more of a subheading. Eg:
#
is equal to <h1>
##
is equal to <h2>
###
is equal to <h3>
####
is equal to <h4>
#####
is equal to <h5>
Headings should be appropriate for their level in the documentation.
Psuedo headers using bold tags **
should be replaced with appropriate level of heading tag.
I would like to get your opinions about splitting zend-cache into different components.
The reason for that is simply a testing and dependency hell.
In my opinion it makes sense to split parts into it's own repository as long as the part requires a non standard extension or another currently optional dependency.
Thoughts ?
This is a structure how this could look like:
I have a cache configuration array (defined in some module config file) that is handed over to StorageFactory::factory():
array(
'adapter' => array(
'name' => 'filesystem',
'options' => array(
'cache_dir' => 'data/cache/navigation',
'dir_level' => 0,
'namespace' => '',
),
),
Now if I want to use another adapter on my local development machine, I insert the following code into my local.php
array(
'adapter' => array(
'name' => 'blackhole',
),
),
This overwrites the adapter name, but does not work: All the other, already given, options are being pushed to the blackhole adapter, but the corresponding methods like setCacheDir()
don't exist there.
(The BlackHole adapter ist just an example, the problem would be the same if you had configured Memcache but want to use Filecache locally.)
So how do you correctly define adapters together with their options in your global config files so they still can be overwritten in local config files?
Thanks in advance, Estigy
About Zend\Cache\Storage\Adapter\Apc
Starting with PHP 7, APCU won't provide the apc_* fonction by default. So the test in __construct will pass, and later other methods will fail with undefined function.
For "legacy" branch
$enabled = ini_get('apc.enabled') && function_exists('apc_store');
For current branch which requires PHP >= 5.5, as no APC version exists I think It could make sense to use APCU by default, and switch all call to apcu_* functions.
Another way could be to create an Zend\Cache\Storage\Adapter\Apcu adapter, and mark the previous as deprecated. But it will require code changes in all consumer of this library.
Comments ?
P.S. notice, for now, apcu 5.0.0-dev segfaults during the test suite.... under investigation.
So, having "zendframework/zend-cache": "~2.4.0" in composer.json won't update to 2.4.8 whic include the security fix for ZF2015-07
TLDR; Check blockquotes are formatted correctly using
>
and check headings in blockquotes are using###
Blockquotes are donated by a single greater than character and then a space. Make sure all the blockquotes in every doc file are correctly formatted. Headings in blockquotes should use ###
and not bold.
Any paragraph spacing in blockquotes should be marked using a single greater than, then a space.
As of the old PHP extension APC seems inactive and doesn't compile with PHP-5.6 / PHP-7 (PHP-5.4 should work but PHP-5.5 not tested) we can drop the adapter for it.
In fact the APC extension is inactive because of the PHP opcache and the possibility to store user data in the cache has been moved to APCu long time ago.
APC and APCu is nearly compatible on storing user data but in some cases it's not. The differences are already part of the Apc adapter.
To simplify the adapter a little bit and because it's no longer possible to use the old APC extension with the minimal required PHP version it makes sense to completely drop support for it.
Renaming the adapter from Apc to Apcu:
If I only take a look what the optimal way would look like it would make sense to also rename the Apc adapter to Apcu. With a deeper look the there are two cases where it could make confusion.
@weierophinney @ezimuel @Ocramius @Maks3w Thoughts?
Why the method getRedisResource() is protected and not public?
In my case, I need to obtain the Redis resource and pass it to some modules (in this case, DoctrineORM).
An extreme fast shared memory cache extension YAC.
It's still in beta and it's not sure if this extension ever reaches it's beta state as it doesn't have a locking mechanism which leads a possibility to retrieve wrong data.
However it seems like this extension is already very popular and alternatives like APCu are still in beta, too.
The Zend Data Cache comes with a compatibility layer for APC but the APC adapter doesn't work with it:
curl -sS -v 'http://localhost/test-zend-cache.php'
* About to connect() to localhost port 80 (#0)
* Trying ::1...
* Connected to localhost (::1) port 80 (#0)
> GET /test-zend-cache.php HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 17 Feb 2016 21:08:54 GMT
< Server: Apache/2.4.6 (CentOS) PHP/5.6.17
< X-Powered-By: PHP/5.6.15 ZendServer/8.5.2
< ZRay-ID: 0@3936@1455741553@0
< Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
< Content-Length: 81
< Content-Type: text/html; charset=UTF-8
<
.............E.......E..EE..E.E.E.....E......E.FF.F.FF......SEEE. 65 / 72 ( 90%)
I currently don't get the full result. Could be a segmentation fault somewhere but it's a bit more work as the Zend Data Cache doesn't run in CLI and this bug is not very impotent.
-> For now if you are using the Zend Data Cache than please use one of the ZendServer[Disk|Shm] adapters.
Error:
array_key_exists(): The first argument should be either a string or an integer
Calling:
$config['cache'] = 'adapter' => [
'name' => 'memcached',
'options' => [
'servers' => [
[
'host' => 'localhost',
'port' => '11211',
],
],
],
];
$cache = StorageFactory::factory($config['cache']);
Stack:
Whoops\Exception\ErrorException: array_key_exists(): The first argument should be either a string or an integer
File "/Users/user/dev/myapp/public/index.php", line 10, in null
$app->run();
File "/Users/user/dev/myapp/vendor/zendframework/zend-mvc/src/Application.php", line 314, in run
$result = $events->trigger(MvcEvent::EVENT_DISPATCH, $event, $shortCircuit);
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 214, in trigger
return $this->triggerListeners($event, $e, $callback);
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 490, in triggerListeners
$responses->push(call_user_func($listenerCallback, $e));
File "/Users/user/dev/myapp/vendor/zendframework/zend-mvc/src/DispatchListener.php", line 93, in onDispatch
$return = $controller->dispatch($request, $response);
File "/Users/user/dev/myapp/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php", line 118, in dispatch
});
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 214, in trigger
return $this->triggerListeners($event, $e, $callback);
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 490, in triggerListeners
$responses->push(call_user_func($listenerCallback, $e));
File "/Users/user/dev/myapp/module/myapp/src/Controller/CliController.php", line 44, in onDispatch
$viewModel = parent::onDispatch($e);
File "/Users/user/dev/myapp/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php", line 82, in onDispatch
$actionResponse = $this->$method();
File "/Users/user/dev/myapp/module/MyModule/src/Controller/Cli/MyModuleController.php", line 29, in importAction
$cache = $this->getCache();
File "/Users/user/dev/myapp/module/MyModule/src/Controller/Cli/MyModuleTrait.php", line 24, in getCache
return StorageFactory::factory($config['cache']);
File "/Users/user/dev/myapp/vendor/zendframework/zend-cache/src/StorageFactory.php", line 72, in factory
$adapter = static::adapterFactory((string) $adapterName, $adapterOptions);
File "/Users/user/dev/myapp/vendor/zendframework/zend-cache/src/StorageFactory.php", line 149, in adapterFactory
$adapter->setOptions($options);
File "/Users/user/dev/myapp/vendor/zendframework/zend-cache/src/Storage/Adapter/Memcached.php", line 131, in setOptions
return parent::setOptions($options);
File "/Users/user/dev/myapp/vendor/zendframework/zend-cache/src/Storage/Adapter/AbstractAdapter.php", line 130, in setOptions
$this->getEventManager()->triggerEvent($event);
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 251, in triggerEvent
return $this->triggerListeners($event->getName(), $event);
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 469, in triggerListeners
$sharedListeners = $this->getSharedListeners($event);
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/EventManager.php", line 530, in getSharedListeners
if (!$listeners = $sharedManager->getListeners($id, $event)) {
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/SharedEventManager.php", line 153, in getListeners
if (!array_key_exists($id, $this->identifiers)) {
File "/Users/user/dev/myapp/vendor/zendframework/zend-eventmanager/src/SharedEventManager.php", line 153, in handleError
if (!array_key_exists($id, $this->identifiers)) {
Implementation could looks like
function getItemWithCallback($key, $callback) {
$item = $this->getItem($key);
if ($item === false) {
$item = $callback($key);
$this->setItem($key, $item);
}
return $item;
}
And with APCu 5.1, this can be override to use new "apcu_entry" API which will manage a lock to avoid bad run race condition, and a single execution of the callback.
When trying to use zend-cache downloaded separately via Composer (under Windows 7, fwiw), the following exception is thrown:
A plugin by the name "exception_handler" was not found in the plugin manager Zend\Cache\Storage\PluginManager
The relevant part of the stack trace:
0 ...\vendor\zendframework\zend-cache\src\StorageFactory.php(203): Zend\ServiceManager\AbstractPluginManager->get('exception_handl...')
composer.json
used to download the package:
{
"name": "test",
"require": {
"zendframework/zend-cache": "^2.5"
}
}
In case of using zend-cache from ZF downloaded entirely ("zendframework/zendframework": "^2.5"
), the issue is not reproduced.
Thanks.
This issue has been moved from the zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7601
User: @Moring
Created On: 2015-07-01T22:35:41Z
Updated At: 2015-11-06T22:06:36Z
Body
Bit of edge case:
Redis is attached to ZF2 cache via socket.
Doctrine redis cache via DoctrineModule\Cache\ZendStorageCache
It will fail intermittently (and always on Doctrine query error).
Error: 'Could not estabilish connection with Redis instance'
Does not occur with port connection.
If: $redis->getTotalSpace() called against ZF2 Redis Cache Adapter before wrapped in DoctrineModule\Cache\ZendStorageCache -- no error.
This issue has been moved from the zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7211
User: @marc-mabe
Created On: 2015-02-12T19:03:23Z
Updated At: 2015-11-06T20:22:37Z
Body
I would like to "fix" some weird logic from cache component.
Memcache
, Memcached
, MongoClient
, Redis
, MongoCollection
, ...)Thoughts ?
ping @Ocramius @weierophinney
$redisCache = \Zend\Cache\StorageFactory::factory([
'adapter' => [
'name' => 'redis'
],
'options' => [
'server' => ['host' => 'localhost'],
]
]);
$cap = $redisCache->getCapabilities();
Fatal error: Call to a member function getMajorVersion() on null in zendframework\zend-cache\src\Storage\Adapter\Redis.php on line 449
$cap instanceof \Zend\Cache\Storage\Capabilities
There is a bug (may be it is a feature)
When I store multiple keys at once instead of storing values (for example int(0) ) it stores something like
i:0;
The reason is in https://github.com/zendframework/zend-cache/blob/master/src/Storage/Adapter/Memcached.php#L403
Code below fixes issue
$namespacedKeyValuePairs[$this->namespacePrefix . $normalizedKey] = $value;
It seems to me that it may be related to all other adapters cause all of them have the same code.
I could provide test if it is necessary.
MongoDB will auto-expire documents if an index is set on the expiration field:
db.cache.ensureIndex( { "expires": 1 }, { expireAfterSeconds: 3600 } )
It doesn't seem like this cache adapter supports this though. What's the best way to implement this? I was thinking that perhaps the internalSetItem() method could get the current indexes, and add the index if it doesn't exist.
After updating from zendframework/zend-cache (2.5.3) to (2.6.0) I got error
array_key_exists(): The first argument should be either a string or an integer
in File: .../vendor/zendframework/zend-eventmanager/src/SharedEventManager.php Line: 153
151: public function getListeners($id, $event)
152: {
153: if (!array_key_exists($id, $this->identifiers)) {
154: return false;
155: }
156: return $this->identifiers[$id]->getListeners($event);
157: }
with arguments:
$key
Zend\EventManager\SharedEventManager(1) ▼ {
identifiers protected => array(0)
}
$search
array(4) ▼ {
"Zend\Mvc\Application" => Zend\EventManager\EventManager(4) ▼ {
events protected => array(1) ▼ {
bootstrap => Zend\Stdlib\PriorityQueue(3) { ... }
}
eventClass protected => "Zend\EventManager\Event" (23)
identifiers protected => array(1) ▼ [
0 => "Zend\Mvc\Application" (20)
]
sharedManager protected => NULL
}
doctrine => Zend\EventManager\EventManager(4) ▼ {
events protected => array(1) ▼ {
"loadCli.post" => Zend\Stdlib\PriorityQueue(3) { ... }
}
eventClass protected => "Zend\EventManager\Event" (23)
identifiers protected => array(1) ▼ [
0 => "doctrine" (8)
]
sharedManager protected => NULL
}
"Zend\Stdlib\DispatchableInterface" => Zend\EventManager\EventManager(4) ▼ {
events protected => array(1) ▼ {
dispatch => Zend\Stdlib\PriorityQueue(3) { ... }
}
eventClass protected => "Zend\EventManager\Event" (23)
identifiers protected => array(1) ▼ [
0 => "Zend\Stdlib\DispatchableInterface" (33)
]
sharedManager protected => NULL
}
profiler => Zend\EventManager\EventManager(4) ▼ {
events protected => array(1) ▼ {
collected => Zend\Stdlib\PriorityQueue(3) { ... }
}
eventClass protected => "Zend\EventManager\Event" (23)
identifiers protected => array(1) ▼ [
0 => "profiler" (8)
]
sharedManager protected => NULL
}
}
Can someone help? -_-
The RedisResourceManager
always returns integer as version information. Therefore, the check in Redis
Adapter wont work as expected.
/**
* Get redis server version
*
* @param string $id
* @return int
* @throws Exception\RuntimeException
*/
public function getMajorVersion($id)
{
// check resource id and initialize the resource
$this->getResource($id);
return (int) $this->resources[$id]['version'];
}
$redisVersion = $this->resourceManager->getMajorVersion($this->resourceId);
// redis >= 2.8
// The command 'pttl' returns -2 if the item does not exist
// and -1 if the item has no associated expire
if (version_compare($redisVersion, '2.8', '>=')) {
$pttl = $redis->pttl($this->namespacePrefix . $normalizedKey);
if ($pttl <= -2) {
return false;
}
$metadata['ttl'] = ($pttl == -1) ? null : $pttl / 1000;
// redis >= 2.6
// The command 'pttl' returns -1 if the item does not exist or the item as no associated expire
} elseif (version_compare($redisVersion, '2.6', '>=')) {
$pttl = $redis->pttl($this->namespacePrefix . $normalizedKey);
if ($pttl <= -1) {
if (!$this->internalHasItem($normalizedKey)) {
return false;
}
$metadata['ttl'] = null;
} else {
$metadata['ttl'] = $pttl / 1000;
}
// redis >= 2
// The command 'pttl' is not supported but 'ttl'
// The command 'ttl' returns 0 if the item does not exist same as if the item is going to be expired
// NOTE: In case of ttl=0 we return false because the item is going to be expired in a very near future
// and then doesn't exist any more
} elseif (version_compare($redisVersion, '2', '>=')) {
$ttl = $redis->ttl($this->namespacePrefix . $normalizedKey);
if ($ttl <= -1) {
if (!$this->internalHasItem($normalizedKey)) {
return false;
}
$metadata['ttl'] = null;
} else {
$metadata['ttl'] = $ttl;
}
// redis < 2
// The commands 'pttl' and 'ttl' are not supported
// but item existence have to be checked
} elseif (!$this->internalHasItem($normalizedKey)) {
return false;
}
How can I register my own plugins that are using a factory? Im using the zend-mvc.
Example for a view-helper:
return [
'view_helpers' => [
'factories' => [
'myViewHelper' => MyViewHelperFactory::class,
],
],
];
If I register my plugin factory in the normal service_manager it just defaults back to the invokable factory. But my plugin has a dependency that should be injected via the constructor...
I've browsed the code but didnt find anything to make it work. Is this currently possible?
Versions in use:
zendframework/zend-cache 2.7.1
zendframework/zend-config 2.6.0
zendframework/zend-eventmanager 3.0.1
zendframework/zend-modulemanager 2.7.2
zendframework/zend-mvc 3.0.3
zendframework/zend-servicemanager 3.1.1
Hi,
we see the following error when using Filesystem storage adapter and deleting a large set of object from cache with clearByTags()
method.
// when file_locking is off in File Zend/Cache/Storage/Adapter/Filesystem.php in line 1363
file_get_contents(my_cache_dir/my_cached_object_4711.tag): failed to open stream: No such file or directory
// when file_locking is on in File Zend/Cache/Storage/Adapter/Filesystem.php in line 1327
fopen(my_cache_dir/my_cached_object_4711.tag): failed to open stream: No such file or directory
It is not that easy to reproduce but occurs as follows:
GlobIterator
in clearByTags()
looks for all .tag files which holds the cached item tags informationGlobIterator
clearByTags
triggers an error at $this->getFileContent($pathname)
because fopen()
or file_get_contents
try to open a non existing file (not existing anymore)Should be simple be avoided by adding
if (!file_exists($file)) { // or !$glob->valid()?
continue;
}
to the foreach loop in clearByTags()
, but is this right?
I also can submit a PR, but until now i do not have found a way to reproduce for a unit test
cheers
Since the docs are located elsewhere this repo's empty wiki should be disabled.
Maybe there is a new way of doing this that I am unaware of but I don't see why this would not be a feature within the redis adapter?
$redis->sAdd('key1' , 'member1');
$redis->sAdd('key1' , 'member2');
$redis->sAdd('key1' , 'member3'); /* 'key1' => {'member1', 'member2', 'member3'}*/
$redis->sIsMember('key1', 'member1'); /* TRUE */
$redis->sIsMember('key1', 'memberX'); /* FALSE */
Currently, it seems the capability to set a TTL on an item in Redis is on instantiation as a set configuration value.
As redis has the ability to be used as a database, or cache. I believe the ability to set the TTL on item creation should be implemented.
For example in addItem(s)
a new parameter $ttl = null
could be appended on and default to the base $options->getTtl()
protected function internalSetItem(& $normalizedKey, & $value, $tt = NULL)
{
$redis = $this->getRedisResource();
$options = $this->getOptions();
$ttl = $ttl ?: $options->getTtl();
...
This will allow the ability to diversify the Redis adapter as a database AND cache storage, instead of one OR the other.
This issue has been moved from the zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7205
User: @marc-mabe
Created On: 2015-02-11T19:43:42Z
Updated At: 2015-02-25T18:26:10Z
Body
This is a prototype!!!!
This would be duplicated in all Options classes requiring some ordering of options.
@Ocramius @weierophinney In my opinion the issue #6381 should be marked as won't fixed as the options will be applied in the order they are defined. This behavior should be documented but not changed into a adapter defined ordering like this prototype. Additionally this prototype shows it's more error prone than the current behavior and would be needed to be document3ed for each adapter what the defined order would resulting in other WTF moments.
User: @weierophinney
Created On: 2015-02-19T21:16:47Z
Updated At: 2015-02-19T21:16:47Z
Body
My feeling is that this shouldn't be abstracted at all. If options need to be set in a particular order, then each options class should implement this functionality accordingly, instead of relying on the parent. This is particularly salient considering you've re-implemented most of the logic of Zend\Stdlib\AbstractOptions::setFromArray()
already; why delegate to the parent at all?
Instead, go through the options in the order in which they should be applied and set them on the instance directly.
One of the most confusion part of the current cache component is the usage of resource manager.
The resource managers are used to instantiate resources (like an instance of Memcache/d
) and to share the same resources over different instances of the fitting interface. Sharing resource is required to not open a new resource (like a network connection) to the same thing only to be able to use different storage instances with different options (like namespace / TTL).
In my opinion the cache adapters should not contain so much complexity and I would like to remove this functionality and simply let inject the resources into the adapters if required.
But where move this functionality to?
Related:
@weierophinney @ezimuel @Maks3w @Ocramius Thoughts?
TLDR; Headers should use the
#
,##
etc to format different levels of headers, and not be underlines using=====
or ``-----`, or be psuedo header using bold
Check all headers on the documentation - headers should use the hash style of declaration rather then be underlined with equals or dashes. The more hashes, the more of a subheading. Eg:
#
is equal to <h1>
##
is equal to <h2>
###
is equal to <h3>
####
is equal to <h4>
#####
is equal to <h5>
Headings should be appropriate for their level in the documentation.
Psuedo headers using bold tags **
should be replaced with appropriate level of heading tag.
This should be possible by the zend_[shm|disk]_cache_add
functions.
Needs to find out at which version these functions are available and if we have to test against it.
I can see it is in b656b63 , but it not in master /cc @weierophinney
TLDR; Check in all files that codeblocks are correct, in PSR-2 format and have PHP syntax highlighting applied.
Code blocks should be in the following format...
```php 'ZEND-FRAMEWORK'); // No required options $rendererOptions = array(); $renderer = Barcode::factory( 'code39', 'image', $barcodeOptions, $rendererOptions ); ```
Note the three backticks then php in the opening fence, and the closing fence is just three backticks. It's common for the opening backticks to have no code type, or something like source.
Code should also have been automatically formatted into PSR-2 format, but sometimes these slip through the net.
persistent_id
of Redis adapter, according to docs, should be something like RDB
or AOF
; however, in the tests, the persistent_id that is setted is a generic number.
What is correct, and what is wrong?
We may not use redis just as a cache storage, but also a db backend. So why not provide redis resource as a global redis resource manager?
Some of the current defined capabilities are very hard to understand/useless and I would like to define some of them.
minTtl
This defines the minimum supported TTL which is clear but only a handful people knows that this also defines the general TTL support.
0 means TTL is supported
There is no adapter having another value than 0 or 1 so this can be renamed to ttlSupported
with bool
.
-> minTtl
needs to be still available for BC reasons until the next major but can be marked deprecated.
staticTtl
This defines how the expiration time will be calculated which is not a meaningful description.
true
means the expiration time will be calculated on read using the last-modification-time of the item, the current time and the current TTL optionfalse
means the expiration time will be calculated using the current TTL and the current time. It will be stored together with the itemThoughts for better names ?
expiredRead
There was the idea that it is possible to read an expired item by setting changing the TTL (like to 0 = infinitive) but this only works with staticTtl=true
to make it possible using an expired item in cases regeneration breaks (like on failed DB connection).
This is a useless capability because changing the TTL to something else automatically changes the expiration time of all stored items if staticTtl=true
which means in case for infinity the item is no longer expired. -> Bam the item is no longer expired but this capability is for reading expired items and the nature of staticTtl
already defines this behavior.
-> I would like to deprecate this capability and remove it in the next major version.
TLDR; All tables should be in the format of GHFM using
|
and-
as horizontal and vertical separators respectively
Check all tables are in the correct format. Please don't use leading and trailing |
- more information on github flavoured markdown tables can be found here.
Hello everyone.
I'm currently running through the process of migrating my ZF2 application to ZF3. I got stuck in a nasty issue which I cannot get around.
Essentially, when Memcached is called for the first time during the application bootstrap phase, the extension throws a response error code (@see http://php.net/manual/en/memcached.getresultcode.php) RES_HOST_LOOKUP_FAILURE
.
However, if I simply try to create a server and connect, set and get a key via php -a
, I'm able to do it. Do we have support for ZF3 here? Or for Memcached?
I take the example from the docs to demonstrate the problem:
'caches' => array( 'Cache\Transient' => array( 'adapter' => 'redis', 'ttl' => 3600, 'options' => array( 'server' => array( 'host'=>'localhost', 'port' => 6379, 'timeout' => 2.5, ), 'database' => 5, 'password' => '', ), 'plugins' => array( 'exception_handler' => array( 'throw_exceptions' => false, ), 'serializer', ), ), ),
The relevant part is the options array.
'options' => array( 'server' => array( 'host'=>'localhost', 'port' => 6379, 'timeout' => 2.5, ), 'database' => 0, 'password' => '', ),
would work, but for example
'options' => array( 'database' => 0, 'server' => array( 'host'=>'localhost', 'port' => 6379, 'timeout' => 2.5, ), 'password' => '', ),
wouldn't.
All the setters in RedisResourceManager look if the id is already initialised, if not, every setter calls setResource with only his own parameter.
setResource merges this with the default array, which has empty array for the server key. At the end of the function setResource always calls normalizeServer, which checks if key host is set and throws an exception, if it's not.
As it is now, the code fails for every initialisation, where server key isn't the first inside the options array, because an exception is thrown.
I'm not making own fix via pull request, because this should be a design decision.
This problem also exists in the LTS 2.4 branch in exactly the same way.
TLDR; Headers should use the
#
,##
etc to format different levels of headers, and not be underlines using=====
or ``-----`, or be psuedo header using bold
Check all headers on the documentation - headers should use the hash style of declaration rather then be underlined with equals or dashes. The more hashes, the more of a subheading. Eg:
#
is equal to <h1>
##
is equal to <h2>
###
is equal to <h3>
####
is equal to <h4>
#####
is equal to <h5>
Headings should be appropriate for their level in the documentation.
Psuedo headers using bold tags **
should be replaced with appropriate level of heading tag.
I think this just can`t work:
https://github.com/zendframework/zend-cache/blob/master/src/Storage/Adapter/AbstractAdapter.php#L193
https://github.com/zendframework/zend-eventmanager/blob/release-2.6.2/src/EventManager.php#L57
BTW, I'm not offending, just complaining, with the v3 oncoming this backward compatibility issues got worse directly, into masters. You know I can`t be happy with things like that. Spending time finding BC breaks in the ZF2 instead of doing work for my clients. I really appreciate your work but this is sad for me that the ZF2 is going like this.
I found out two reasons:
echo "yes\nno\n" | pecl -d preferred_state=beta install apcu || return 0
pecl
This issue has been moved from the zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7467
User: @startef
Created On: 2015-04-28T23:31:13Z
Updated At: 2015-11-06T22:14:14Z
Body
Hello,
I recently encountered an old problem that was first described and fixed here: zendframework/zendframework#6048
On my more busy projects the logs get filled up with
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getMTime(): stat failed for .../some/dir/filename.dat' in .../some/dir/zendframework/zend-cache/Zend/Cache/Storage/Adapter/Filesystem.php:153
The ExceptionHandler should have taken care of it actually, but somehow it doesn't anymore.
startef
Edit: Just noticed, it is not only the getMTime(). It also shows exceptions for unlink(), probably for the same reason of concurrent requests.
Edit2: PHP-Version is 5.5.22
User: @startef
Created On: 2015-08-17T10:20:16Z
Updated At: 2015-08-17T10:20:16Z
Body
A temporary solution was posted at heiseonline/shariff-backend-php#22
Fatal error: xcache_set(): Objects cannot be stored in the variable cache. Use serialize before xcache_set in /Users/matt/www/httpd/zend-cache/src/Storage/Adapter/XCache.php on line 348
As the docs say:
Warning : At the moment, It is not possible to store resources, callbacks or objects using xcache_* functions.
Looks the adapter needs to have "object" => false in it's supportedDatatypes options and also throw an exception instead of fatal error. I'm using xcache 3.2.0.
BTW, xcache > 3.1.0 does support CLI, so there's no need to skip the tests for stuff like this. I'll do a PR.
Hi, the setItem method on the Filesystem adapter allows a mixed as value. However internally when blocking is enabled, it will try to do a fwrite which requires the data to be a string. Shouldn't Filesystem adapter require data as a string also? or at least serialize the value if it is not a string before attempting to fwrite.
no matter what i do i get
Class 'Zend\Serializer\Serializer' not found
this is with any version ^2.7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.