forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple lru cache into utils. (envoyproxy#8)
* Add simple lru cache into utils. * Format files.
- Loading branch information
1 parent
f585f33
commit 9c38034
Showing
5 changed files
with
2,300 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* Copyright 2017 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef MIXERCLIENT_UTILS_GOOGLE_MACROS_H_ | ||
#define MIXERCLIENT_UTILS_GOOGLE_MACROS_H_ | ||
|
||
#undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS | ||
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \ | ||
TypeName(const TypeName&); \ | ||
void operator=(const TypeName&) | ||
|
||
#endif // MIXERCLIENT_UTILS_GOOGLE_MACROS_H_ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* Copyright 2017 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// For inclusion in .h files. The real class definition is in | ||
// simple_lru_cache_inl.h. | ||
|
||
#ifndef MIXERCLIENT_UTILS_SIMPLE_LRU_CACHE_H_ | ||
#define MIXERCLIENT_UTILS_SIMPLE_LRU_CACHE_H_ | ||
|
||
#include <functional> | ||
#include <unordered_map> // for hash<> | ||
|
||
namespace istio { | ||
namespace mixer_client { | ||
|
||
namespace internal { | ||
template <typename T> | ||
struct SimpleLRUHash : public std::hash<T> {}; | ||
} // namespace internal | ||
|
||
template <typename Key, typename Value, | ||
typename H = internal::SimpleLRUHash<Key>, | ||
typename EQ = std::equal_to<Key> > | ||
class SimpleLRUCache; | ||
|
||
// Deleter is a functor that defines how to delete a Value*. That is, it | ||
// contains a public method: | ||
// operator() (Value* value) | ||
// See example in the associated unittest. | ||
template <typename Key, typename Value, typename Deleter, | ||
typename H = internal::SimpleLRUHash<Key>, | ||
typename EQ = std::equal_to<Key> > | ||
class SimpleLRUCacheWithDeleter; | ||
|
||
} // namespace mixer_client | ||
} // namespace istio | ||
|
||
#endif // MIXERCLIENT_UTILS_SIMPLE_LRU_CACHE_H_ |
Oops, something went wrong.