Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/services/caches.py b/services/caches.py
index 8869d61..e72b9a2 100644
--- a/services/caches.py
+++ b/services/caches.py
@@ -1,4 +1,4 @@
-# Copyright 2020 The Chromium Authors. All rights reserved.
+# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Classes to manage cached values.
@@ -53,7 +53,7 @@
def CacheAll(self, new_item_dict):
"""Cache all items in the given dict, dropping old items if needed."""
if len(new_item_dict) >= self.max_size:
- logging.warn('Dumping the entire cache! %s', self.kind)
+ logging.warning('Dumping the entire cache! %s', self.kind)
self.cache = {}
else:
while len(self.cache) + len(new_item_dict) > self.max_size:
@@ -108,7 +108,6 @@
def LocalInvalidateAll(self):
"""Invalidate all keys locally: just start over with an empty dict."""
- logging.info('Locally invalidating all in kind=%r', self.kind)
self.cache = {}
def InvalidateAll(self, cnxn):
@@ -160,7 +159,7 @@
def InvalidateKeys(self, cnxn, keys):
"""Drop keys locally, and append their values to the Invalidate DB table."""
# Find values to invalidate.
- values = [self.cache[key] for key in keys if self.cache.has_key(key)]
+ values = [self.cache[key] for key in keys if key in self.cache]
if len(values) == len(keys):
for value in values:
self.LocalInvalidate(value)
@@ -346,7 +345,7 @@
'kind': self.cache.kind,
'prefix': self.prefix,
'count': len(keys),
- 'keys': str(keys)
+ 'keys': str(keys)[:100000]
})
memcache.delete_multi(
[self._KeyToStr(key) for key in keys],