Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix `LruCache` corruption bug with a `size_callback` that can return 0 (#11454) | Sean Quah | 2021-11-30 | 1 | -1/+4 |
| | | | | | | | | | | | When all entries in an `LruCache` have a size of 0 according to the provided `size_callback`, and `drop_from_cache` is called on a cache node, the node would be unlinked from the LRU linked list but remain in the cache dictionary. An assertion would be later be tripped due to the inconsistency. Avoid unintentionally calling `__len__` and use a strict `is None` check instead when unwrapping the weak reference. | ||||
* | Eliminate a few `Any`s in `LruCache` type hints (#11453) | Sean Quah | 2021-11-30 | 1 | -16/+21 |
| | |||||
* | More types for synapse.util, part 1 (#10888) | David Robertson | 2021-10-06 | 1 | -31/+26 |
| | | | | | | | | | | | | | | The following modules now pass `disallow_untyped_defs`: * synapse.util.caches.cached_call * synapse.util.caches.lrucache * synapse.util.caches.response_cache * synapse.util.caches.stream_change_cache * synapse.util.caches.ttlcache pass * synapse.util.daemonize * synapse.util.patch_inline_callbacks pass `no-untyped-defs` * synapse.util.versionstring Additional typing in synapse.util.metrics. Didn't get this to pass `no-untyped-defs`, think I'll need to watch #10847 | ||||
* | Opt out of cache expiry for `get_users_who_share_room_with_user` (#10826) | David Robertson | 2021-09-22 | 1 | -3/+13 |
| | | | | * Allow LruCaches to opt out of time-based expiry * Don't expire `get_users_who_share_room` & friends | ||||
* | Track why we're evicting from caches (#10829) | David Robertson | 2021-09-22 | 1 | -2/+2 |
| | | | So we can see distinguish between "evicting because the cache is too big" and "evicting because the cache entries haven't been recently used". | ||||
* | Add types to synapse.util. (#10601) | reivilibre | 2021-09-10 | 1 | -2/+3 |
| | |||||
* | [pyupgrade] `synapse/` (#10348) | Jonathan de Jong | 2021-07-19 | 1 | -2/+1 |
| | | | | | | | | | This PR is tantamount to running ``` pyupgrade --py36-plus --keep-percent-format `find synapse/ -type f -name "*.py"` ``` Part of #9744 | ||||
* | Use inline type hints in `http/federation/`, `storage/` and `util/` (#10381) | Jonathan de Jong | 2021-07-15 | 1 | -4/+4 |
| | |||||
* | Add support for evicting cache entries based on last access time. (#10205) | Erik Johnston | 2021-07-05 | 1 | -35/+202 |
| | |||||
* | Combine `LruCache.invalidate` and `invalidate_many` (#9973) | Richard van der Hoff | 2021-05-27 | 1 | -7/+11 |
| | | | | | | | | | | * Make `invalidate` and `invalidate_many` do the same thing ... so that we can do either over the invalidation replication stream, and also because they always confused me a bit. * Kill off `invalidate_many` * changelog | ||||
* | Remove `keylen` from `LruCache`. (#9993) | Richard van der Hoff | 2021-05-24 | 1 | -6/+4 |
| | | | | | | | `keylen` seems to be a thing that is frequently incorrectly set, and we don't really need it. The only time it was used was to figure out if we had removed a subtree in `del_multi`, which we can do better by changing `TreeCache.pop` to return a different type (`TreeCacheNode`). Commits should be independently reviewable. | ||||
* | Optionally track memory usage of each LruCache (#9881) | Erik Johnston | 2021-05-05 | 1 | -1/+47 |
| | | | | | This will double count slightly in the presence of interned strings. It's off by default as it can consume a lot of resources. | ||||
* | Reduce memory footprint of caches (#9886) | Erik Johnston | 2021-04-28 | 1 | -18/+59 |
| | |||||
* | Remove redundant "coding: utf-8" lines (#9786) | Jonathan de Jong | 2021-04-14 | 1 | -1/+0 |
| | | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>` | ||||
* | Bugbear: Add Mutable Parameter fixes (#9682) | Jonathan de Jong | 2021-04-08 | 1 | -6/+8 |
| | | | | | | | Part of #9366 Adds in fixes for B006 and B008, both relating to mutable parameter lint errors. Signed-off-by: Jonathan de Jong <jonathan@automatia.nl> | ||||
* | Fix 'LruCache' object has no attribute '_on_resize' (#8591) | Richard van der Hoff | 2020-10-19 | 1 | -1/+9 |
| | | | We need to make sure we are readu for the `set_cache_factor` callback. | ||||
* | Replace DeferredCache with LruCache where possible (#8563) | Richard van der Hoff | 2020-10-19 | 1 | -0/+3 |
| | | | Most of these uses don't need a full-blown DeferredCache; LruCache is lighter and more appropriate. | ||||
* | review comments | Richard van der Hoff | 2020-10-16 | 1 | -3/+8 |
| | |||||
* | Apply suggestions from code review | Richard van der Hoff | 2020-10-16 | 1 | -1/+1 |
| | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> | ||||
* | type annotations for LruCache | Richard van der Hoff | 2020-10-16 | 1 | -12/+61 |
| | |||||
* | Make LruCache register its own metrics (#8561) | Richard van der Hoff | 2020-10-16 | 1 | -11/+35 |
| | | | | | rather than have everything that instantiates an LruCache manage metrics separately, have LruCache do it itself. | ||||
* | Add some more type annotations to Cache | Richard van der Hoff | 2020-10-14 | 1 | -1/+2 |
| | |||||
* | Stop sub-classing object (#8249) | Patrick Cloke | 2020-09-04 | 1 | -2/+2 |
| | |||||
* | Don't apply cache factor to event cache. (#7578) | Erik Johnston | 2020-05-27 | 1 | -0/+4 |
| | | | | This is already correctly done when we instansiate the cache, but wasn't when it got reloaded (which always happens at least once on startup). | ||||
* | Allow configuration of Synapse's cache without using synctl or environment ↵ | Amber Brown | 2020-05-11 | 1 | -9/+43 |
| | | | | variables (#6391) | ||||
* | Run Black. (#5482) | Amber Brown | 2019-06-20 | 1 | -2/+12 |
| | |||||
* | run isort | Amber Brown | 2018-07-09 | 1 | -1/+1 |
| | |||||
* | Add comments | Erik Johnston | 2018-03-19 | 1 | -0/+7 |
| | |||||
* | Fix bug where state cache used lots of memory | Erik Johnston | 2018-03-15 | 1 | -4/+4 |
| | | | | | | | | | The state cache bases its size on the sum of the size of entries. The size of the entry is calculated once on insertion, so it is important that the size of entries does not change. The DictionaryCache modified the entries size, which caused the state cache to incorrectly think it was smaller than it actually was. | ||||
* | report metrics on number of cache evictions | Richard van der Hoff | 2018-02-05 | 1 | -3/+25 |
| | |||||
* | Update LruCache size estimate on clear | Erik Johnston | 2017-01-18 | 1 | -0/+2 |
| | |||||
* | Remove needless call to evict() | Erik Johnston | 2017-01-17 | 1 | -1/+0 |
| | |||||
* | Speed up cache size calculation | Erik Johnston | 2017-01-17 | 1 | -17/+25 |
| | | | | | | | | | | | Instead of calculating the size of the cache repeatedly, which can take a long time now that it can use a callback, instead cache the size and update that on insertion and deletion. This requires changing the cache descriptors to have two caches, one for pending deferreds and the other for the actual values. There's no reason to evict from the pending deferreds as they won't take up any more memory. | ||||
* | Optionally measure size of cache by sum of length of values | Erik Johnston | 2017-01-13 | 1 | -14/+18 |
| | |||||
* | Ensure invalidation list does not grow unboundedly | Erik Johnston | 2016-08-19 | 1 | -8/+8 |
| | |||||
* | Add concept of cache contexts | Erik Johnston | 2016-08-19 | 1 | -7/+32 |
| | |||||
* | Make LruCache use a dedicated _Node class | Erik Johnston | 2016-03-22 | 1 | -32/+41 |
| | |||||
* | Remove spurious self.size | Erik Johnston | 2016-01-29 | 1 | -1/+0 |
| | |||||
* | Make TreeCache keep track of its own size. | Erik Johnston | 2016-01-29 | 1 | -6/+3 |
| | |||||
* | Reset size on clear | Erik Johnston | 2016-01-29 | 1 | -0/+2 |
| | |||||
* | Don't add the member functiopn if we're not using treecache | David Baker | 2016-01-22 | 1 | -1/+4 |
| | |||||
* | docs | David Baker | 2016-01-22 | 1 | -1/+5 |
| | |||||
* | Revert all the bits changing keys of eeverything that used LRUCaches to tuples | David Baker | 2016-01-22 | 1 | -1/+1 |
| | |||||
* | Make LRU cache not default to treecache & add options to use it | David Baker | 2016-01-22 | 1 | -4/+5 |
| | |||||
* | Change LRUCache to be tree-based so we can delete subtrees. | David Baker | 2016-01-21 | 1 | -8/+35 |
| | |||||
* | copyrights | Matthew Hodgson | 2016-01-07 | 1 | -1/+1 |
| | |||||
* | Move all the caches into their own package, synapse.util.caches | Erik Johnston | 2015-08-11 | 1 | -0/+149 |