sonata-project / sonatacachebundle Goto Github PK
View Code? Open in Web Editor NEW[Abandoned] This bundle provides caching services
Home Page: https://github.com/sonata-project/SonataCacheBundle
License: MIT License
[Abandoned] This bundle provides caching services
Home Page: https://github.com/sonata-project/SonataCacheBundle
License: MIT License
We try to focus our time and energy on the core sonata bundles (admin, media, classification, seo ...).
Since no sonata-maintainer is using this project, there is no active support on this bundle.
That's why we will be marked it as abandoned.
Feel free to ask if you want to keep this project up to date.
i have get this command
sudo php composer.phar require sonata-project/cache-bundle
but this want know the version....
Please provide a version constraint for the sonata-project/cache-bundle requirement:
i use symfony 2.1.3
Is there any hope that we could use memcache instead of memcached? The problem is memcached dll is not yet available on windows.
I'm using Symfony 2.4.1.
CacheBundle was downloaded today.
All configuration has been done manually.
I left an issue at this address: sonata-project/SonataAdminBundle#1951, hoping someone could deal with it.
I think there is a FQNS mistake of Sonata when it generates de caches files needed.
Thanks in advance.
I have correct configured APC cache in my config.yml file
Command line function sonata:cache:flush-all calls
flushAll function from ApcCache class. This function using sockets to connect server and clear apc cache.
cacheAction returns new response with text 'ok'
return new Response('ok', 200, array(
'Cache-Control' => 'no-cache, must-revalidate'
));
flushaAll function checks if response from sever has text 'ok', but on my apache2 instance response from cacheAction is
HTTP/1.1 200 OK
Date: Sun, 16 Dec 2012 17:18:38 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.6-1ubuntu1.1
Set-Cookie: PHPSESSID=7pna43krovjanjg09n9njsho53; path=/
cache-control: must-revalidate, no-cache, private
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
without 'ok' text and sonata:cache:flush-all for APC always return FAILED.
$ app/console conf:dump sonata_cache
Default configuration for extension with alias: "sonata_cache"
sonata_cache:
cache_invalidation:
orm_listener: auto
phpcr_odm_listener: auto
service: sonata.cache.invalidation.simple
recorder: sonata.cache.recorder
# and so on
It seems, that cache_invalidation
for MongoDB is missing.
related => #44
Currently the bundle only test, if the class exists:
$useOrm = 'auto' == $config['cache_invalidation']['orm_listener'] ?
class_exists('Doctrine\\ORM\\Version') :
$config['cache_invalidation']['orm_listener'];
if ($useOrm) {
$loader->load('orm.xml');
}
$usePhpcrOdm = 'auto' == $config['cache_invalidation']['phpcr_odm_listener'] ?
class_exists('Doctrine\\PHPCR\\ODM\\Version') :
$config['cache_invalidation']['phpcr_odm_listener'];
if ($usePhpcrOdm) {
$loader->load('phpcr_odm.xml');
}
This is unreliable and will break, if the bundle exists, but isn't enabled. Of course I can set orm_listener
/phpcr_odm_listener
manually to false
(from auto
), but that is usually not something somebody expect from an automation.
With only this composer.json and no other files or code
{
"require": {
"sonata-project/cache-bundle": "dev-master"
}
}
A call of "composer install" fails with the following message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for sonata-project/cache-bundle dev-master -> satisfiable by sonata-project/cache-bundle[dev- master].
- sonata-project/cache-bundle dev-master requires sonata-project/cache ~1.0@dev -> no matching package found.
Memcache(d)/Redis/APC/database - all supports increment/decrement methods with nice performance. SonataCache should support them too. Maybe it may fail to BC change, because CacheElement is a bit useless in this situation.
My use case:
I'm using SonataCacheBundle and their cache services as core of my caching implementation.
I would like to log all views of some items to memcache using fast increment method from Memcache. I will read all items from memcache and store them regularly to database using cron.
i tried to use this bundle along with doctrine dbal and the DoctrineBundle, but do not want the doctrine2 orm, just the dbal. however, as soon as i have DoctrineBundle activated, i get
Fatal error: Class 'Doctrine\ORM\Events' not found in
...cmf-sandbox/vendor/bundles/Sonata/CacheBundle/Invalidation/DoctrineORMListenerContainerAware.php on line 42
could we make the bundle work without the doctrine orm available? for now i just include the code without using it, but that feels a bit stupid.
To find Twig base template class, Sonata\CacheBundle\SonataCacheBundle::boot
method gets twig
service from container and does not check if it exists. See SonataCacheBundle.php#L29
Execute following commands:
composer create-project symfony/skeleton .
composer require sonata-project/cache-bundle
You will see a error message:
!!
!! In Container.php line 270:
!!
!! You have requested a non-existent service "twig".
!!
The main goal of SonataCacheBundle::boot
method it to call attachRecorder
method of a Twig base template class. This method exists only in Sonata\CacheBundle\Twig\TwigTemplate13
and Sonata\CacheBundle\Twig\TwigTemplate14
classes and these classes are removed in master
branch.
To create a recipe for Flex, error with non-existent twig
service must be fixed. How do you think what is the best solution: (1) to add symfony/twig-bundle
to composer.json or (2) to add a "wrapper" if ($this->container->has('twig
)) { ... }in
SonataCacheBundle::boot` method?
And anyway boot method should be removed in master branch.
There is a problem while getting the subrequest controller because attributes are not set yet...
File : \Sonata\CacheBundle\Adapter\SsiCache
Method : cacheAction
$subRequest = Request::create('', 'get', $parameters, $request->cookies->all(), array(), $request->server->all());
$controller = $this->resolver->getController($subRequest);
$subRequest->attributes->add(array('_controller' => $parameters['controller']));
$subRequest->attributes->add($parameters['parameters']);
This is throwing an exception: Function () does not exist
I think the getController line should be after the attributes add, like this.
$subRequest = Request::create('', 'get', $parameters, $request->cookies->all(), array(), $request->server->all());
$subRequest->attributes->add(array('_controller' => $parameters['controller']));
$subRequest->attributes->add($parameters['parameters']);
$controller = $this->resolver->getController($subRequest);
What do you guys think about this issue ?
Hi,
Since a recent update I got a PHP fatal error :
PHP Fatal error: Call to undefined method Symfony\Component\Config\Definition\Builder\NodeBuilder::enumNode() in /var/www/vendor/bundles/Sonata/CacheBundle/DependencyInjection/Configuration.php on line 35
I guess it's since commit 6a2ceb7.
PHP version: 5.3.2
Symfony2 version: 2.0.17
I'm new to Symfony2 and SonataAdmin, but before this commit, I never had any problem with the master branch of SonataCacheBundle. I tried to revert to 2.0 branch, but it was unusable.
Redis extension: https://github.com/nicolasff/phpredis
haven't really studied this possibility .. just wondering if maybe it would make sense to switch to using the new Fragment system introduced in 2.2: https://github.com/symfony/HttpKernel/tree/master/Fragment
I just installed SonataCacheBundle 2.2.5 and I had to install symfony/monolog-bundle, so should it added into the composer.json of SonataCacheBundle?
To use the CacheBundle, I have added the following lines to app/config/config.yml file.
sonata_cache:
caches:
esi:
token: an unique security key # a random one is generated by default
servers:
- varnishadm -T 127.0.0.1:2000 {{ COMMAND }} "{{ EXPRESSION }}"
ssi:
token: an unique security key # a random one is generated by default
mongo:
database: cache
collection: cache
servers:
- {host: 127.0.0.1, port: 27017, user: username, password: pASS'}
- {host: 127.0.0.2}
memcached:
prefix: test # prefix to ensure there is no clash between instances
servers:
- {host: 127.0.0.1, port: 11211, weight: 0}
apc:
token: s3cur3 # token used to clear the related cache
prefix: test # prefix to ensure there is no clash between instances
servers:
- { domain: kooqit.local, ip: 127.0.0.1, port: 80}
but it shows error while running the project...I dont know whats going wrong...
Error:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options "caches" under "sonata_cache"
Any help will be appreciable...Thanks in advance
After upgrading symfony to 2.0.15 and doctrine to 2.1.6 I am getting this error
ParameterNotFoundException: You have requested a non-existent parameter "doctrine.connections".
in /html/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php line 96
at ParameterBag->get() in /html/app/bootstrap.php.cache line 130
at Container->getParameter() in /html/vendor/bundles/Sonata/CacheBundle/DependencyInjection/SonataCacheExtension.php line 82
at SonataCacheExtension->configureORM() in /html/vendor/bundles/Sonata/CacheBundle/DependencyInjection/SonataCacheExtension.php line 49
at SonataCacheExtension->load() in /html/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php line 42
at MergeExtensionConfigurationPass->process() in /html/vendor/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process() in /html/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php line 119
at Compiler->compile() in /html/vendor/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 437
at ContainerBuilder->compile() in /html/app/bootstrap.php.cache line 872
at Kernel->buildContainer() in /html/app/bootstrap.php.cache line 783
at Kernel->initializeContainer() in /html/app/bootstrap.php.cache line 517
at Kernel->boot() in /html/app/bootstrap.php.cache line 548
at Kernel->handle() in /html/web/app_dev.php line 30
Because of symfony/twig-bundle@a1d022d, there is a BC break in this bundle :
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
The parameter "twig.options" must be defined.
SonataCacheBundle.php
tries to access twig.options
parameter to get base_template_class
. Unfortunately, it seems like there is no way to access this value with the current TwigExtension
code.
Should an issue be opened on Symfony side ? Or should Sonata code be changed somehow ?
There is no need for the bundle anymore. Symfony / PSR cache is more common. Even doctrine dropped their custom cache.
dev and prod
$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle 3.41.0 3.45.1 The missing Symfony Admin Generator
sonata-project/block-bundle 3.12.1 3.14.0 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 2.0.1 Cache library
sonata-project/cache-bundle 3.0.1 3.0.1 This bundle provides caching services
sonata-project/core-bundle 3.12.0 3.15.1 Symfony SonataCoreBundle
sonata-project/datagrid-bundle 2.4.0 2.4.0 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.1.2 1.1.5 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.6.3 3.8.1 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle 2.5.0 2.5.0 Symfony SonataEasyExtendsBundle
sonata-project/exporter 1.9.1 2.0.1 Lightweight Exporter library
sonata-project/user-bundle 4.2.3 4.2.3 Symfony SonataUserBundle
$ composer show --latest 'symfony/*'
symfony/apache-pack v1.0.1 v1.0.1 A pack for Apache support in Symfony
symfony/asset v4.2.1 v4.2.2 Symfony Asset Component
symfony/browser-kit v4.2.1 v4.2.2 Symfony BrowserKit Component
symfony/cache v4.2.1 v4.2.2 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/config v4.2.2 v4.2.2 Symfony Config Component
symfony/console v4.2.1 v4.2.2 Symfony Console Component
symfony/contracts v1.0.2 v1.0.2 A set of abstractions extracted out of the Symfony components
symfony/css-selector v4.2.1 v4.2.2 Symfony CssSelector Component
symfony/debug v4.2.2 v4.2.2 Symfony Debug Component
symfony/debug-bundle v4.2.1 v4.2.2 Symfony DebugBundle
symfony/dependency-injection v4.2.2 v4.2.2 Symfony DependencyInjection Component
symfony/doctrine-bridge v4.2.1 v4.2.2 Symfony Doctrine Bridge
symfony/dom-crawler v4.2.1 v4.2.2 Symfony DomCrawler Component
symfony/dotenv v4.2.1 v4.2.2 Registers environment variables from a .env file
symfony/event-dispatcher v4.2.2 v4.2.2 Symfony EventDispatcher Component
symfony/expression-language v4.2.1 v4.2.2 Symfony ExpressionLanguage Component
symfony/filesystem v4.2.2 v4.2.2 Symfony Filesystem Component
symfony/finder v4.2.1 v4.2.2 Symfony Finder Component
symfony/flex v1.1.8 v1.1.8 Composer plugin for Symfony
symfony/form v4.2.1 v4.2.2 Symfony Form Component
symfony/framework-bundle v4.2.1 v4.2.2 Symfony FrameworkBundle
symfony/http-foundation v4.2.2 v4.2.2 Symfony HttpFoundation Component
symfony/http-kernel v4.2.2 v4.2.2 Symfony HttpKernel Component
symfony/inflector v4.2.1 v4.2.2 Symfony Inflector Component
symfony/intl v4.2.1 v4.2.2 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/options-resolver v4.2.1 v4.2.2 Symfony OptionsResolver Component
symfony/phpunit-bridge v4.2.1 v4.2.2 Symfony PHPUnit Bridge
symfony/polyfill-ctype v1.10.0 v1.10.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu v1.10.0 v1.10.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.10.0 v1.10.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.10.0 v1.10.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/process v4.2.2 v4.2.2 Symfony Process Component
symfony/property-access v4.2.1 v4.2.2 Symfony PropertyAccess Component
symfony/property-info v4.2.1 v4.2.2 Symfony Property Info Component
symfony/routing v4.2.2 v4.2.2 Symfony Routing Component
symfony/security-acl v3.0.1 v3.0.1 Symfony Security Component - ACL (Access Control List)
symfony/security-bundle v4.2.1 v4.2.2 Symfony SecurityBundle
symfony/security-core v4.2.1 v4.2.2 Symfony Security Component - Core Library
symfony/security-csrf v4.2.1 v4.2.2 Symfony Security Component - CSRF Library
symfony/security-guard v4.2.1 v4.2.2 Symfony Security Component - Guard
symfony/security-http v4.2.1 v4.2.2 Symfony Security Component - HTTP Integration
symfony/serializer v4.2.1 v4.2.2 Symfony Serializer Component
symfony/stopwatch v4.2.1 v4.2.2 Symfony Stopwatch Component
symfony/swiftmailer-bundle v3.2.4 v3.2.5 Symfony SwiftmailerBundle
symfony/templating v4.2.1 v4.2.2 Symfony Templating Component
symfony/translation v4.2.1 v4.2.2 Symfony Translation Component
symfony/twig-bridge v4.2.1 v4.2.2 Symfony Twig Bridge
symfony/twig-bundle v4.2.1 v4.2.2 Symfony TwigBundle
symfony/validator v4.2.1 v4.2.2 Symfony Validator Component
symfony/var-dumper v4.2.1 v4.2.2 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter v4.2.1 v4.2.2 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-profiler-bundle v4.2.1 v4.2.2 Symfony WebProfilerBundle
symfony/web-server-bundle v4.2.1 v4.2.2 Symfony WebServerBundle
symfony/yaml v4.2.1 v4.2.2 Symfony Yaml Component```
$ php -v
PHP 7.2.12 (cli) (built: Nov 29 2018 01:59:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.12, Copyright (c) 1999-2018, by Zend Technologies
The sonata.cache.manager
service is private, so I cannot flush the cache with
php bin/console sonata:cache:flush-all
php bin/console sonata:cache:flush-all
The cache being cleared.
The "sonata.cache.manager" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependenc
y injection instead.
On a SF4 install, I've installed
composer show -l | egrep -i cache
doctrine/cache v1.7.1 = v1.7.1 Caching library offering an object-oriented API for many cache backends
doctrine/doctrine-cache-bundle 1.3.3 = 1.3.3 Symfony Bundle for Doctrine Cache
friendsofsymfony/http-cache 2.2.1 = 2.2.1 Tools to manage HTTP caching proxies with PHP
friendsofsymfony/http-cache-bundle dev-master 8af6922 = dev-master 8af6922 Set path based HTTP cache headers and send invalidation requests to your HTTP cache
psr/cache 1.0.1 = 1.0.1 Common interface for caching libraries
psr/simple-cache 1.0.1 = 1.0.1 Common interfaces for simple caching
sonata-project/cache 1.x-dev 0d2849c ~ dev-master a3db30d Cache library
sonata-project/cache-bundle 2.x-dev 359f9af ~ dev-master d9d1658 This bundle provides caching services
symfony/cache v4.0.8 = v4.0.8 Symfony Cache component with PSR-6, PSR-16, and tags
I routinely get these php.INFO notices:
[2018-04-07 21:11:46] php.INFO: User Deprecated: Not providing a "Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface" instance to "Sonata\CacheBundle\Adapter\VarnishCache::__construct" is deprecated since 3.x and will not be possible in 4.0 {"exception":"[object] (ErrorException(code: 0): User Deprecated: Not providing a \"Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface\" instance to \"Sonata\\CacheBundle\\Adapter\\VarnishCache::__construct\" is deprecated since 3.x and will not be possible in 4.0 at /opt/test/vendor/sonata-project/cache-bundle/src/Adapter/VarnishCache.php:89)"} []
in the source
vendor/sonata-project/cache-bundle/src/Adapter/VarnishCache.php
if (interface_exists(ArgumentResolverInterface::class) && !$argumentResolver) {
@trigger_error(sprintf(
'Not providing a "%s" instance to "%s" is deprecated since 3.x and will not be possible in 4.0',
ArgumentResolverInterface::class,
__METHOD__
89 ), E_USER_DEPRECATED);
}
Not clear WHAT package's "3.x" & "4.0" versions that message is referring to ...
I try to use SonataBlockBundle with SonataCacheBundle. After documentation reading and setting up all described steps, i got that error:
An exception has been thrown during the rendering of a template ("Please define a controller key") in CatalogBundle::index.html.twig at line 34.
My configuration:
# config.yml
sonata_cache:
caches:
ssi:
token: 'superprivatetoken'
sonata_block:
default_contexts: [cms]
blocks:
block.search: ~
block.popular.products:
cache: sonata.cache.ssi
#routing.yml
sonata_cache_cache:
resource: '@SonataCacheBundle/Resources/config/routing/cache.xml'
prefix: /
options: { i18n: false }
# PopularProductsBlockService.php
class PopularProductsBlockService extends BaseBlockService
{
public function __construct($name, EngineInterface $templating, DocumentManager $documentManager)
{
$this->name = $name;
$this->templating = $templating;
$this->documentManager = $documentManager;
}
/**
* {@inheritdoc}
*/
public function execute(BlockContextInterface $blockContext, Response $response = null)
{
$limit = 15; // @TODO: limit from settings.
$items = $this->documentManager
->getRepository('ProductBundle:Product')
->findMostViewed($limit)
;
return $this->renderResponse(
$blockContext->getTemplate(),
array(
'items' => $items,
'block' => $blockContext->getBlock(),
'block_context' => $blockContext,
),
$response
);
}
# index.html.twig
{{ sonata_block_render({ 'type': 'block.popular.products' }) }}
I ran into this problem:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "sonata.cache.invalidation.simple" has a dependency on a non-existent service "logger".
and tried all the in the only hit on google for that error. I could only fix this by patching Resources/config/cache.xml in sonata-project/cache-bundle:
remove <argument type="service" id="logger" /> and add <argument type="service" id="mailer" />
While using SonataCacheBundle in a Flex application, I get an error about missing doctrine.connections
:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "doctrine.connections".
Exception trace:
() at .../vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:100
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get() at .../vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php:56
Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get() at .../vendor/symfony/dependency-injection/Container.php:146
Symfony\Component\DependencyInjection\Container->getParameter() at .../vendor/sonata-project/cache-bundle/DependencyInjection/SonataCacheExtension.php:97
Sonata\CacheBundle\DependencyInjection\SonataCacheExtension->configureORM() at .../vendor/sonata-project/cache-bundle/DependencyInjection/SonataCacheExtension.php:62
Sonata\CacheBundle\DependencyInjection\SonataCacheExtension->load() at .../vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php:66
Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process() at .../vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php:39
Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() at .../vendor/symfony/dependency-injection/Compiler/Compiler.php:143
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at .../vendor/symfony/dependency-injection/ContainerBuilder.php:746
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at .../vendor/symfony/http-kernel/Kernel.php:575
Symfony\Component\HttpKernel\Kernel->initializeContainer() at .../vendor/symfony/http-kernel/Kernel.php:117
Symfony\Component\HttpKernel\Kernel->boot() at .../vendor/symfony/framework-bundle/Console/Application.php:65
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at .../vendor/symfony/console/Application.php:125
Symfony\Component\Console\Application->run() at .../bin/console:36
This occurs because the SonataCacheExtension use a parameter registered by DoctrineBundle
.
As we are adding the subscriber to every connection, I suggest to remove this code and add the doctrine.event_subscriber
to the sonata.cache.orm.event_subscriber
definition without the connection
attribute.
Same change could be applied to the sonata.cache.phpcr_odm.event_subscriber
definition.
If you agree with those changes, I will open a PR.
Hi!
I'm using the SonataCacheBundle in one of our projects along with the Redis backend. I'm currently in an active development phase and as such, need all the debug information I can get.
It would be nice to have an integration with Symfony's Profiler/Debug toolbar for the cache requests.
We could for instance see the keys currently in cache, the keys requested during the current request, the keys that have been set, along with maybe some performance counters?
I'd be available to help listing what could be nice to have in such a page and also, if time allows, to help with the coding side!
Thanks for considering this idea and for this very useful bundle!
Is the symfony caching adapter mentioned in the configuration documentation complete? Unlike the other caching Adapters, the Sonata\CacheBundle\Adapter\SymfonyCache has
method throws this exception:
throw new UnsupportedException('Symfony cache has() method does not exists');
Here's the method's full code:
/**
* {@inheritdoc}
*/
public function has(array $keys)
{
throw new UnsupportedException('Symfony cache has() method does not exists');
}
I would like to have two or more memcache cache services with different configurations (prefix, different servers) and I would like to set their own names.
The bundle configuration defined in app/config.yml must be changed to make this working.
MemchedCache class set invalid expiration time of cache element.
TTL should be set as $cacheElement->getTtl() no as time() + $cacheElement->getTtl().
For example when you set time()+10 seconds - does not work and cache will not be set, but set 10 second will set cache for 10 seconds.
From documentation:
"Expiration times can be set from 0, meaning “never expire”, to 30 days. Any time higher than 30 days is interpreted as a unix timestamp date. If you want to expire an object on january 1st of next year, this is how you do that."
Hi,
I found an issue in the sonata-project/cache/lib/Adapter/Cache/MongoCache.php
file's getCollection()
method, while trying to connect to MongoDB using a password with @ in it.
I took a look in the Doctrine ODM's setup, and it connects to Mongo using \MongoClient
's array of options in the constructor.
Also I saw that even if a database is specified in the config.yml
, the getCollection()
method tries to connect to the default admin
database. Taking a look in the PHP's docs reveals that it should specify the database in the connection string, eg. mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
.
Kind regards.
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.