refine region refresh method for cache decorators

Declined
#1 · Created  · Last updated

Declined pull request

OK we have to try again here, there's too much happening in this pullreq. 1. refresh not working with asdict - that's fixed in 699b0d7581fec36f2739ec5e. 2. `ct=None` argument. OK, you want it on set() and set_multi() as well, fine. Here is what that needs: a. name of the argument is "creation_time" b. docstring describing :param creation_time: on both public methods c. unit tests in test_region d. wasn't the point of the time argument here for get_or_create()? why isn't it being used there in get_value() (similarly in the multi version)? 3. mutex in refresh - I don't understand this, let's get #2 as a separate pull req first. My perception of refresh was that it's just like "set" - it does not address dogpiling. The dogpiling problem and associated mutexing is supposed to be addressed only in get_or_create(), get_or_create_multi(). If "refresh" is really, "do a get_or_create with a guaranteed expiration", then that is really a different call altogether. we've already released refresh() as is, so this should definitely be using get_or_create[_multi] to do the work, and possibly be called "refresh_dogpile()" or something better.

Closed by: ·2013-06-27

Description

  1. add asdict support for cache_multi_on_arguments

  2. add lock and ct in refresh method to keep the cached value always thenewest value.

There're still 2 issues:

  1. the refresh don't support decorate for class method. as there's no selfargs.

  2. about the tests, I create 2 test scripts here: https://gist.github.com/lxyu/5874652 . While it has global variable inside for communicate between threads, I found no elegant way to put them in tests/.

Any suggestion?

Thanks!

0 attachments

0 comments

Loading commits...