sqlalchemy / sqlalchemy/dogpile.cache

method support in function_key_generator / function_multi_key_generator

Open
#95 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
299
Forks
50
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by Wolfgang Schnerring (wosc)

It would be nice if function_key_generator would support methods in addition to plain functions.

An example implementation is here: https://github.com/ZeitOnline/pyramid_dogpile_cache2/blob/1.0.1/src/pyramid_dogpile_cache2/cache.py#L26

I haven't found a way to do this other than computing the namespace during each function call (instead of only once and storing it in the closure), since at definition time I think you don't have enough information about the function etc. available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementations of function_key_generator and function_multi_key_generator, then compare their behavior with the example in pyramid_dogpile_cache2/cache.py. Determine how method support should work without losing the existing function behavior, and define completion by covering both generators and their method use cases with tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.