thadeusb/flask-cache — Issue #16: Memoized?
Author: 23doors
Created: 2012-02-03 22:28:49+00:00
State: open

I am a little worried with how memoized seems to work here. Say, we're using more persistent cache than simple thread local storage.

Specifically if we use the example here:
@cache.memoize(3600)
def has_membership(role):
return self.groups.filter_by(role=role).count() >= 1

And call has_membership('something') - it is cached.

In following request we call: cache.delete_memoized('has_membership') and what it should do is delete all memoized versions of this function. Well, it won't.

Correct me if I am wrong but you're keeping track of memoized functions by simply storing them in self field and in following requests - it is empty on init. This is not scalable at all and will only work in simplest of cases. Bad design decision, that's for sure.