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

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Jun 15, 2018

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

This comment has been minimized.

sqlalchemy-bot commented Jun 15, 2018

Michael Bayer (zzzeek) wrote:

just an .actual_backend accessor? sure

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 19, 2018

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 20, 2018

Michael Bayer (zzzeek) wrote:

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

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 20, 2018

jvanasco (jvanasco) wrote:

have a great trip!

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 20, 2018

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

This comment has been minimized.

sqlalchemy-bot commented Jun 27, 2018

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

This comment has been minimized.

sqlalchemy-bot commented Jun 27, 2018

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