Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
6d7b2204
Commit
6d7b2204
authored
4 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
review comments
parent
995cc615
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/util/caches/lrucache.py
+8
-3
8 additions, 3 deletions
synapse/util/caches/lrucache.py
with
8 additions
and
3 deletions
synapse/util/caches/lrucache.py
+
8
−
3
View file @
6d7b2204
...
...
@@ -34,11 +34,16 @@ from synapse.config import cache as cache_config
from
synapse.util.caches
import
CacheMetric
,
register_cache
from
synapse.util.caches.treecache
import
TreeCache
T
=
TypeVar
(
"
T
"
)
# Function type: the type used for invalidation callbacks
FT
=
TypeVar
(
"
FT
"
,
bound
=
Callable
[...,
Any
])
# Key and Value type for the cache
KT
=
TypeVar
(
"
KT
"
)
VT
=
TypeVar
(
"
VT
"
)
# a general type var, distinct from either KT or VT
T
=
TypeVar
(
"
T
"
)
def
enumerate_leaves
(
node
,
depth
):
if
depth
==
0
:
...
...
@@ -227,7 +232,7 @@ class LruCache(Generic[KT, VT]):
@synchronized
def
cache_get
(
key
:
KT
,
default
=
None
,
default
:
Optional
[
T
]
=
None
,
callbacks
:
Iterable
[
Callable
[[],
None
]]
=
[],
update_metrics
:
bool
=
True
,
):
...
...
@@ -291,7 +296,7 @@ class LruCache(Generic[KT, VT]):
...
@synchronized
def
cache_pop
(
key
:
KT
,
default
=
None
):
def
cache_pop
(
key
:
KT
,
default
:
Optional
[
T
]
=
None
):
node
=
cache
.
get
(
key
,
None
)
if
node
:
delete_node
(
node
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment