-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a routing cache interface to the common/lib
- Loading branch information
Showing
4 changed files
with
61 additions
and
12 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,18 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Routes, Empty } from "./types"; | ||
|
||
/** | ||
* Abstract class for a cache, to be able to swap out different | ||
* caches between different portal implementations. | ||
*/ | ||
export interface RoutingCacheInterface { | ||
get(key: string): Promise<Routes | Empty | undefined>; | ||
/// A note on Empty: | ||
/// This is used to indicate that the cache does not have a value for the key. | ||
/// It is used to differentiate between a cache miss and a cache hit with an empty value. | ||
/// Cache hit with empty values should not trigger a fetch from the fullnode. | ||
set(key: string, value: Routes | Empty): Promise<void>; | ||
delete(key: string): Promise<void>; | ||
} |
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