Leaseweb / LswMemcacheBundle

Symfony bundle for Memcache Doctrine caching and session storage in the Web Debug Toolbar.
MIT License
202 stars 57 forks source link

Is there a command for clearing cache by client? #46

Closed bigfoot90 closed 9 years ago

bigfoot90 commented 9 years ago

Is there a command for clearing cache by client?

mevdschee commented 9 years ago

app/console memcache:clear

bigfoot90 commented 9 years ago

Suppose you have the following configuration:

lsw_memcache:
    session:
        client: sessions
        prefix: "session_"
    doctrine:
        metadata_cache:
            client: doctrine
            entity_manager: default          # the name of your entity_manager connection
            document_manager: default        # the name of your document_manager connection
        result_cache:
            client: doctrine
            entity_manager: [default, read]  # you may specify multiple entity_managers
            prefix: "result_"                # you may specify a prefix for the entries
        query_cache:
            client: doctrine
            entity_manager: default
    clients:
        sessions:
            hosts:
                - { dsn: localhost, port: 11212 }
        doctrine:
                - { dsn: localhost, port: 11212 }

I want to clear only the doctrine cache, but your command clears all. I'm using the command with regex app/console memcache:clear --regex='^(?!session_)' as a fallback for now. But a command like this app/console memcache:clear --client=doctrine would be much cleaner.

mevdschee commented 9 years ago

@bigfoot90 I think this is already supported with the client parameter. Can you confirm?

bigfoot90 commented 9 years ago

It seems that it work correctly now. closing. Thanks @mevdschee

mevdschee commented 9 years ago

Thank you.