-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(kubernetes): Make cache keys immutable (#3826)
* refactor(kubernetes): Make cache keys immutable We don't ever change cache keys after construction, but they still support (unused) setters. Make these keys immutable so we can safely use them as keys in sets/maps. * fix(kubernetes): Fix serialization of cache keys Some cache key types don't have symmetry between serialization and deserialization logic. Fix them so that they do so we can create a key and call toString() and get the same result as if we directly created the string key. * refactor(kubernetes): Move key constructors into inner classes The top-level Keys class supports a number of methods for creating a String representation of various key types. Move these methods into the relevant inner classes and rename them createKey. * perf(kubernetes): Short-circuit string replacement As a performance improvement, don't allocate a new string for every key part we're processing via the replaceAll(). Instead check whether they key has a ':' first which is relatively cheap compared to alwyas allocating a new string.
- Loading branch information
Showing
13 changed files
with
147 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.