|
1 | | -const GLOBAL_CACHES = Any[] |
| 1 | +const GLOBAL_CACHES = Pair{Symbol,Any}[] |
2 | 2 | function empty_globalcaches!() |
3 | | - foreach(empty!, GLOBAL_CACHES) |
| 3 | + foreach(empty! ∘ last, GLOBAL_CACHES) |
4 | 4 | return nothing |
5 | 5 | end |
6 | 6 |
|
| 7 | +function global_cache_info(io::IO=stdout) |
| 8 | + for (name, cache) in GLOBAL_CACHES |
| 9 | + println(io, name, ":\t", LRUCache.cache_info(cache)) |
| 10 | + end |
| 11 | +end |
| 12 | + |
7 | 13 | abstract type CacheStyle end |
8 | 14 | struct NoCache <: CacheStyle end |
9 | 15 | struct TaskLocalCache{D<:AbstractDict} <: CacheStyle end |
@@ -140,7 +146,8 @@ macro cached(ex) |
140 | 146 | fglobalcachedef = Expr(:const, |
141 | 147 | Expr(:(=), globalcachename, |
142 | 148 | :(LRU{Any,Any}(; maxsize=DEFAULT_GLOBALCACHE_SIZE[])))) |
143 | | - fglobalcacheregister = Expr(:call, :push!, :GLOBAL_CACHES, globalcachename) |
| 149 | + fglobalcacheregister = Expr(:call, :push!, :GLOBAL_CACHES, |
| 150 | + :($(QuoteNode(globalcachename)) => $globalcachename)) |
144 | 151 |
|
145 | 152 | # # total expression |
146 | 153 | return esc(Expr(:block, _fex, newfex, fnocacheex, flocalcacheex, |
|
0 commit comments