cryptiklemur / cache-bundle Goto Github PK
View Code? Open in Web Editor NEWIntegrated Cache Bundle for Symfony
Integrated Cache Bundle for Symfony
If you want to use or test the bundle with php 7.x, composer will fail with the following error.
- aequasi/cache-bundle 3.0.2 requires php ~5.3 -> your PHP version (7.0.8) does not satisfy that requirement.
It is quite uncommon for bundles to require the whole "symfony/symfony", because that will result in dependency problems when symfony components in diferent versions are used.
Maybe the dependency could be reduced to "symfony/framework-bundle".
I downloaded the latest version but I get this error
I am using Symfony 2.0.1
Call to undefined method Symfony\Component\Config\Definition\Builder\NodeBuilder::append()
The example configuration shows that the session TTL value is set as shown:
aequasi_cache:
session:
enabled: true
instance: default
prefix: "session_"
ttl: 1800
However, the TTL value specified here is not used, instead the cookie_lifetime
value is used from the Symfony framework session configuration.
Hello,
I've a great problem: on the one hand I really want and need speed thing up a little bit by using memcache in my symfony2 application. On the other hand I have at least one or two single queries I never want to be cached.
Any idea how to do that?
Is there a way to set memcached options?
The options
array in the instances
configuration is not defined to contain any values.
I just tested your cache bundl which looks great.
For dev and testing purpose, I need to use the file cache.
On the file Aequasi\Bundle\CacheBundle\DependencyInjection\Configuration.php on line 73 you're setting the available type option:
->values(array('redis', 'file', 'memcached', 'apc'))
After digging into your code, it appears the file option is not available.
Instead we should use php_file or file_system.
I found out that after looking on the services.yml file
It seems that there is other type possibility too:
array, memcache, win_cache, xcache and zend_data.
I didn't test them.
So to correct the issue, it seems the only required action is to update the availble option by setting:
->values(array('redis', 'php_file', 'file_system', 'memcached', 'apc'))
(and maybe more for the others)
I used your memcached bundle before and switched to the new cache-bundle. Unfortunatly it seems that the session caching doesn't work like before. It simply doesn't find the sessions in the memcache (we are using elasticcache)
Can someone tell me how to install using the composer version is available at https://github.com/aequasi/cache-bundle.
There in the configuration indicates support php 7.0 https://github.com/aequasi/cache-bundle/blob/master/composer.json
When I run in console
composer.phar require aequasi/cache-bundle
installed version 2.4 which not support php 7.0 -(
I have no way to switch to php-cache bundle -((
Is it possible to add a command to clear memcache from CLI? I know I can do it with just memcache but it would be nice for our builds to clear routing and doctrine metadata cache without any special privileges to directly contact Memcached.
Anytime I attempt to create multiple memcached instances I am greeted my whitescreens of death.
It doesn't say in the documentation that I can't split things across multiple memcached clusters, so I'm just curious if this is expected behaviour?
hi,
it seems your cache key generation is overlooking the underlying UrlMatching logic of symfony
protected function matchCollection($pathinfo, RouteCollection $routes)
{
foreach ($routes as $name => $route) {
$compiledRoute = $route->compile();
// check the static prefix of the URL first. Only use the more expensive preg_match when it matches
if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) {
continue;
}
if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) {
continue;
}
$hostMatches = array();
if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) {
continue;
}
// check HTTP method requirement
if ($req = $route->getRequirement('_method')) {
// HEAD and GET are equivalent as per RFC
if ('HEAD' === $method = $this->context->getMethod()) {
$method = 'GET';
}
if (!in_array($method, $req = explode('|', strtoupper($req)))) {
$this->allow = array_merge($this->allow, $req);
continue;
}
}
$status = $this->handleRouteRequirements($pathinfo, $name, $route);
if (self::ROUTE_MATCH === $status[0]) {
return $status[1];
}
if (self::REQUIREMENT_MISMATCH === $status[0]) {
continue;
}
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches));
}
}
if two routes with same path_info
is defined and has different Controller end-points Your cache implementation will always call the first match of the cache entry against the path but overlooks the rest of route matching logic in symfony.
public function match($pathInfo)
{
$key = 'route_' . $pathInfo;
if ($this->cache->contains($key)) {
return $this->cache->fetch($key);
}
$match = parent::match($pathInfo);
$this->cache->save($key, $match, 60 * 60 * 24 * 7);
return $match;
}
at least $key
should include minimal request method to overcome issue, however if there are complex routes defines with extra requirements other than request method then the cache key generation should take into account of all requirements of a route.
When running composer install I get the following issue:
aequasi/cache-bundle dev-master requires psr/cache-implementation ~1.0 -> no matching package found.
How about letting travis build against multiple symfony versions?
Example configuration here: https://github.com/h4cc/AliceFixturesBundle/blob/master/.travis.yml
I could configure that if wished :)
It also appears that clearing the metadata cache doesn't work with memcached
To reproduce:
Create an entity and store cache in memcached
Edit / Add / Remove a column from the entity and attempt to perform a doctrine schema update
Experiencing a weird issue with cache-bundle.
Using cache-bundle with persistant:true on configuration, persistant connexion never close and memcached current_openned_connection number never stop increasing.
If you use fos/rest bundle and using routing caching from aequasi memcache bundle, the bundle does not stores the http verb to cache.
you have two routes:
If you send a PUT without routing caching enabled, it jumps in the right method. If you send a PUT with routing caching enabled, it jumps in getUserProfile instead of putUserProfile.
It would be better, if you also cache the http verb: e.g.: get_user_profile, put_user_profile
Cant install this bundle on symfony3:
composer update
....
- aequasi/cache-bundle 3.0.2 requires symfony/symfony ~2.2 -> no matching package found.
Any plans to support symfony3 soon?
Or how can i make composor ignore the dependency?
If you do not setup the session storage (e.g. because you want to store the data in the database like we do) the bundle cannot be setup properly:
ContextErrorException: Notice: Undefined index: instance in /home/benjamin/www/web/vendor/aequasi/cache-bundle/src/Aequasi/Bundle/CacheBundle/DependencyInjection/Compiler/SessionSupportCompilerPass.php line 42
Adding phpunit as a dev dependency will make it easier for new devs, and more reproduceable for unit tests.
Hi !
I want to try file cache, but i get this error :
file
is not a valid cache type. If you are using a custom type, make sure to add your service.
And i see in services.yml there are many caches services: array, xcache, ...
But the config only accept : 'redis', 'file', 'memcached', 'apc'.
Is it possible to use these other services ?
Thanks for your help
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.