Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extending proxies with the actual backend? #123

Closed
sqlalchemy-bot opened this issue Jun 15, 2018 · 7 comments
Closed

extending proxies with the actual backend? #123

sqlalchemy-bot opened this issue Jun 15, 2018 · 7 comments
Labels

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by jvanasco (jvanasco)

In several situations, I must access the actual backend of a dogpile region which has multiple proxies applied by wraps.

i've usually been handling it during setup by caching the value onto the topmost object after configuring the region. I derive the actual backend via...

_backend = region.backend
while hasattr(_backend, 'proxied'):
    _backend = _backend.proxied

i think accessing this is useful to enough people, so I propose extending wraps/ProxyBackend to track the final proxy/actual backend on the object within dogpile itself.

I am willing to generate a PR, but if there are objections to this I won't bother.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (zzzeek) wrote:

just an .actual_backend accessor? sure

@sqlalchemy-bot
Copy link
Author

jvanasco (jvanasco) wrote:

attempt #1 is https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/65

@sqlalchemy-bot
Copy link
Author

Michael Bayer (zzzeek) wrote:

OK, I'm travelling the rest of the week so, will try to get to this next week.

@sqlalchemy-bot
Copy link
Author

jvanasco (jvanasco) wrote:

have a great trip!

@sqlalchemy-bot
Copy link
Author

jvanasco (jvanasco) wrote:

just adding to this ticket a link to a writeup on the use-case scenario: I needed to start working with the raw redis client to accomplish some work via lua scripting.

https://gist.github.com/jvanasco/7ee03c118885bd06e25b651e3139f606

@sqlalchemy-bot
Copy link
Author

Michael Bayer (zzzeek) wrote:

added CacheRegion.actual_backend

Added method :meth:.CacheRegion.actual_backend which calculates and
caches the actual backend for the region, which may be abstracted by
the use of one or more :class:ProxyBackend subclasses.

Change-Id: I91cb858b233bae642c47178e2e7a780b2fef801c
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/65
Fixes: #123

ccfa1ba

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (zzzeek):

  • changed status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant