Skip to content

Commit

Permalink
Merge pull request #1485 from Netflix/avoid-array-allocation-Response…
Browse files Browse the repository at this point in the history
…CacheImpl

avoid array allocation in ResponseCacheImpl
  • Loading branch information
alexburnos authored Jan 24, 2023
2 parents 191cc40 + 14c5103 commit efc1cf6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
* @author Karthik Ranganathan, Greg Kim
*/
public class ResponseCacheImpl implements ResponseCache {
private static final Key.KeyType[] KEY_TYPE_VALUES = Key.KeyType.values();
private static final Version[] VERSION_VALUES = Version.values();

private static final Logger logger = LoggerFactory.getLogger(ResponseCacheImpl.class);

Expand Down Expand Up @@ -249,8 +251,8 @@ public void stop() {
*/
@Override
public void invalidate(String appName, @Nullable String vipAddress, @Nullable String secureVipAddress) {
for (Key.KeyType type : Key.KeyType.values()) {
for (Version v : Version.values()) {
for (Key.KeyType type : KEY_TYPE_VALUES) {
for (Version v : VERSION_VALUES) {
invalidate(
new Key(Key.EntityType.Application, appName, type, v, EurekaAccept.full),
new Key(Key.EntityType.Application, appName, type, v, EurekaAccept.compact),
Expand Down

0 comments on commit efc1cf6

Please sign in to comment.