Memoization: After computing a solution to a
subproblem, store it in a table. Subsequent calls
check the table to avoid redoing work.
I have been using the method for something else, caching costly REST calls.
getIssueCreateMeta
"Retrieves the metadata for all types of issues. Fields are expanded"
^ self isMemoizingMeta��
ifTrue: [ ([ :ignored | self getIssueCreateMetaWithExpandKeys: true ] memoizedUsing: self cache ) value: #issueCreateMeta ]
ifFalse: [ self getIssueCreateMetaWithExpandKeys: true ]
using:
cache
^ cache ifNil: [cache := LRUCache new maximumWeight: self defaultCacheWeight ]
It is nice to see the cache hit rate etc in the inspector.
BTW I am interested to see how one coul dwrite the code above without repeating the block.
Also, :ignored is not used by the method but is the cache key.
Phil