-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into cache_key_serialization
Signed-off-by: Sagar <[email protected]>
- Loading branch information
Showing
34 changed files
with
1,904 additions
and
85 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
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
34 changes: 34 additions & 0 deletions
34
server/src/main/java/org/opensearch/common/cache/ICache.java
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,34 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.cache; | ||
|
||
/** | ||
* Represents a cache interface. | ||
* @param <K> Type of key. | ||
* @param <V> Type of value. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public interface ICache<K, V> { | ||
V get(K key); | ||
|
||
void put(K key, V value); | ||
|
||
V computeIfAbsent(K key, LoadAwareCacheLoader<K, V> loader) throws Exception; | ||
|
||
void invalidate(K key); | ||
|
||
void invalidateAll(); | ||
|
||
Iterable<K> keys(); | ||
|
||
long count(); | ||
|
||
void refresh(); | ||
} |
20 changes: 20 additions & 0 deletions
20
server/src/main/java/org/opensearch/common/cache/LoadAwareCacheLoader.java
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,20 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.cache; | ||
|
||
/** | ||
* Extends a cache loader with awareness of whether the data is loaded or not. | ||
* @param <K> Type of key. | ||
* @param <V> Type of value. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public interface LoadAwareCacheLoader<K, V> extends CacheLoader<K, V> { | ||
boolean isLoaded(); | ||
} |
Oops, something went wrong.