开发者

Caching aspect - how to create key from method name and arguments

开发者 https://www.devze.com 2023-01-13 12:35 出处:网络
I am creating an aspect to appl开发者_如何学Pythony to methods that checks the cache for a return value, and only permits procession onto the logic of the method if the cache is empty or stale.

I am creating an aspect to appl开发者_如何学Pythony to methods that checks the cache for a return value, and only permits procession onto the logic of the method if the cache is empty or stale.

I need to generate a cache key for the storage of this information that is unique to the method call for a given set of arguments. My initial hunch is to implement a key creation algorithm that takes the qualified method name and appends serialised argument information.

Is there a recognised approach to key creation under these circumstances?

0

精彩评论

暂无评论...
验证码 换一张
取 消