As the name implies, @Cacheable is used to demarcate methods that are cacheable - that is, methods for whom the result is stored into the cache so on subsequent invocations (with the same arguments), the value in the cache is returned without having to actually execute the method.
我遇到了一个名为Tek271的记忆库,它看起来像您描述的那样使用注释来记忆函数。在
Spring3.1现在提供了一个^{} annotation ,正是这样做的。在
我不认为有一个母语实现的记忆。在
但作为方法的装饰器,您可以很容易地实现它。你必须维护一个地图:地图的关键是参数,值是结果。在
对于单参数方法,这里是一个简单的实现:
相关问题 更多 >
编程相关推荐