0

我是 Symfony 的新手,我正在深入了解 OroCommerce。我以为我已经成功设置了 SncRedis(仅基于应用程序退出向我抛出错误的事实)。但是,现在应用程序已完全设置和安装,我可以看到仍在生成基于文件的缓存。

我有 aconfig.yml和 aconfig_prod.yml但似乎config_prod.yml只扩展了 theconfig.yml所以我认为config_prod.yml.

# config.yml
imports:
    - { resource: parameters.yml }
    - { resource: security.yml }

framework:
    #esi:             ~
    translator:      { fallback: en }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: "%kernel.debug%"
    form:            true
    csrf_protection: true
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig', 'php']
        assets_version: %assets_version%
        assets_version_format: %%s?version=%%s
    default_locale:           "%locale%"
    trusted_proxies:          ~
    session: ~
    fragments:
        enabled:              true
        path:                 /_fragment # used for controller action in template
    serializer:
        enabled:              true
    annotations:
        cache: oro.cache.annotations

# Twig Configuration
twig:
    debug:                    "%kernel.debug%"
    strict_variables:         "%kernel.debug%"
    exception_controller:     "FOS\RestBundle\Controller\ExceptionController::showAction"
    globals:
        bap:
            layout:           ::base.html.twig  # default layout across all Oro bundles

# Assetic Configuration
assetic:
    debug:                    false
    use_controller:           false
    filters:
        cssrewrite: ~
        lessphp:
            file: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php
            apply_to: "\.less$"
            paths: ["%kernel.root_dir%/../web/bundles"]
        cssmin:
            file: %kernel.root_dir%/Resources/php/cssmin-v3.0.1.php

# Swiftmailer Configuration
swiftmailer:
    transport:                "%mailer_transport%"
    host:                     "%mailer_host%"
    port:                     "%mailer_port%"
    encryption:               "%mailer_encryption%"
    username:                 "%mailer_user%"
    password:                 "%mailer_password%"
    spool:                    { type: memory }

fos_rest:
    body_listener:
        decoders:
            json: fos_rest.decoder.json
    view:
        failed_validation:    HTTP_BAD_REQUEST
        default_engine:       php
        formats:
            json:             true
            xml:              false
    format_listener:
        rules:
            - { path: '^/api/rest', priorities: [ json ], fallback_format: json, prefer_extension: false }
            - { path: '^/api/soap', stop: true }
            - { path: '^/', stop: true }
    routing_loader:
        default_format:       json

fos_js_routing:
    routes_to_expose:         [oro_*]

oro_frontend:
    routes_to_expose:         [oro_*]

stof_doctrine_extensions:
    default_locale: en
    translation_fallback: true
    orm:
        default:
            translatable:     true
            tree:             true

services:
    twig.extension.intl:
         class:               Twig_Extensions_Extension_Intl
         tags:
             - { name: twig.extension }

    oro.cache.abstract:
        abstract: true
        class: Snc\RedisBundle\Doctrine\Cache\RedisCache
        calls:
            - [setRedis, ["@snc_redis.default"]]

    oro.cache.annotations:
        public: false
        parent: oro.cache.abstract
        calls:
            - [ setNamespace, [ "oro_annotations_cache" ] ]

escape_wsse_authentication:
    authentication_provider_class: Oro\Bundle\UserBundle\Security\WsseAuthProvider

genemu_form:
    select2: ~
    autocomplete: ~

a2lix_translation_form:
    locales: [en, fr]
    templating: "OroUIBundle:Form:translatable.html.twig"

lexik_maintenance:
    authorized:
        path:                 "maintenance|.*\.js"             # "maintenance" is only for demo purposes, remove in production!
#        ips:                  ["127.0.0.1"]                   # Optional. Authorized ip addresses
    driver:
        class:                Lexik\Bundle\MaintenanceBundle\Drivers\FileDriver
        options:
            file_path:        %kernel.root_dir%/cache/maintenance_lock

#
# ORO Bundles config
#
oro_distribution:
    entry_point: ~

oro_require_js:
    build_path:               "js/oro.min.js"
    building_timeout:         3600
    build:
        preserveLicenseComments: true

oro_help:
    defaults:
        server: http://help.orocrm.com/
        prefix: Third_Party
    vendors:
        Oro:
            prefix: ~
            alias: Platform
    routes:
        oro_default:
            uri: Platform/OroDashboardBundle

oro_theme:
    active_theme: oro

oro_message_queue:
    transport:
        default: '%message_queue_transport%'
        '%message_queue_transport%': '%message_queue_transport_config%'
    client: ~

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: redis://redis-session
            logging: %kernel.debug%
        session:
            type: predis
            alias: session
            dsn: redis://redis-session/4
            logging: %kernel.debug%
        cache:
            type: predis
            alias: cache
            dsn: redis://redis-session/1
            logging: true
        profiler_storage:
            type: predis
            alias: profiler_storage
            dsn: redis://redis-session/2
            logging: false
    session:
        client: session
        prefix: session
    doctrine:
        metadata_cache:
            client: cache
            entity_manager: default
            document_manager: default
        result_cache:
            client: cache
            entity_manager: [default, read]
            document_manager: [default, slave1, slave2]
            namespace: "dcrc:"
        query_cache:
            client: cache
            entity_manager: default
    swiftmailer:
        client: default
        key: swiftmailer
doctrine:
    orm:
        query_cache_driver: redis
        result_cache_driver: redis

jms_serializer:
    metadata:
        cache: Metadata\Cache\DoctrineCacheAdapter
4

1 回答 1

0

您可以安装具有依赖关系的OroRedisConfigBundlesnc/redis-bundle代替。之后要使用 redis,您需要在parameters.yml应用程序中添加 4 行,例如: session_handler: 'snc_redis.session.handler' redis_dsn_session: 'redis://127.0.0.1:6379/0' redis_dsn_cache: 'redis://127.0.0.1:6380/0' redis_dsn_doctrine: 'redis://127.0.0.1:6380/1' 不要忘记清除应用程序缓存。

关于缓存文件夹(app/cache/prod例如)。对于 Symfony 应用程序,即使您启用了 redis,它也总是如此。

于 2018-03-21T09:29:44.363 回答