From da5ead306648dfbf4b16ade617166991e35da8ff Mon Sep 17 00:00:00 2001 From: stan220 Date: Sun, 26 Jan 2020 13:20:12 +0300 Subject: [PATCH] Added predis lib. Added +session +doctrine cache. --- composer.json | 1 + composer.lock | 52 +++++++++++++++++++++++++++++- config/packages/doctrine.yaml | 10 ++++++ config/packages/framework.yaml | 2 +- config/packages/prod/doctrine.yaml | 18 +++++------ config/services.yaml | 13 ++++++++ symfony.lock | 3 ++ 7 files changed, 88 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 0757b19..094a052 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "ext-iconv": "*", "knpuniversity/oauth2-client-bundle": "^1.32", "league/oauth2-google": "^3.0", + "predis/predis": "^1.1", "sensio/framework-extra-bundle": "^5.5", "symfony/apache-pack": "^1.0", "symfony/asset": "4.4.*", diff --git a/composer.lock b/composer.lock index 1bfa45a..a263d6a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "067b0e9ecd420b1b48945900bf4c8987", + "content-hash": "486a0b9f008b383a0bdd60439cb32c18", "packages": [ { "name": "doctrine/annotations", @@ -1967,6 +1967,56 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "time": "2019-08-22T18:11:29+00:00" }, + { + "name": "predis/predis", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/nrk/predis.git", + "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", + "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "ext-curl": "Allows access to Webdis when paired with phpiredis", + "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" + }, + "type": "library", + "autoload": { + "psr-4": { + "Predis\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniele Alessandri", + "email": "suppakilla@gmail.com", + "homepage": "http://clorophilla.net" + } + ], + "description": "Flexible and feature-complete Redis client for PHP and HHVM", + "homepage": "http://github.com/nrk/predis", + "keywords": [ + "nosql", + "predis", + "redis" + ], + "time": "2016-06-16T16:22:20+00:00" + }, { "name": "psr/cache", "version": "1.0.1", diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 5e80e77..850ac21 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -16,3 +16,13 @@ doctrine: dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App + + metadata_cache_driver: + type: service + id: redis_cache_service + result_cache_driver: + type: service + id: redis_cache_service + query_cache_driver: + type: service + id: redis_cache_service \ No newline at end of file diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 6089f4b..7ffd682 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -6,7 +6,7 @@ framework: # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. session: - handler_id: null + handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler cookie_secure: auto cookie_samesite: lax diff --git a/config/packages/prod/doctrine.yaml b/config/packages/prod/doctrine.yaml index 084f59a..430a858 100644 --- a/config/packages/prod/doctrine.yaml +++ b/config/packages/prod/doctrine.yaml @@ -1,15 +1,15 @@ doctrine: orm: auto_generate_proxy_classes: false - metadata_cache_driver: - type: pool - pool: doctrine.system_cache_pool - query_cache_driver: - type: pool - pool: doctrine.system_cache_pool - result_cache_driver: - type: pool - pool: doctrine.result_cache_pool +# metadata_cache_driver: +# type: pool +# pool: doctrine.system_cache_pool +# query_cache_driver: +# type: pool +# pool: doctrine.system_cache_pool +# result_cache_driver: +# type: pool +# pool: doctrine.result_cache_pool framework: cache: diff --git a/config/services.yaml b/config/services.yaml index 4c5b1a7..d0a7e3f 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -25,3 +25,16 @@ services: # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones + + Predis\Client: + arguments: + - '%env(REDIS_URL)%' + + Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler: + arguments: + - '@Predis\Client' + + redis_cache_service: + class: Doctrine\Common\Cache\PredisCache + arguments: + - '@Predis\Client' \ No newline at end of file diff --git a/symfony.lock b/symfony.lock index fc32fcd..ef9e4ce 100644 --- a/symfony.lock +++ b/symfony.lock @@ -144,6 +144,9 @@ "phpdocumentor/type-resolver": { "version": "1.0.1" }, + "predis/predis": { + "version": "v1.1.1" + }, "psr/cache": { "version": "1.0.1" },