Created
June 6, 2020 15:05
-
-
Save ldclakmal/507303557ab12282349ca885e87946b0 to your computer and use it in GitHub Desktop.
Custom Cache of Ballerina
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
public type CustomCache object { | |
*AbstractCache; | |
private AbstractEvictionPolicy evictionPolicy; | |
private LinkedList list; | |
public function __init(AbstractEvictionPolicy evictionPolicy) { | |
self.evictionPolicy = evictionPolicy; | |
self.list = { | |
head: (), | |
tail: () | |
}; | |
} | |
public function get(string key) returns any|Error { | |
// custom implementation related to retrieving the `Node` | |
// from the persistence storage. | |
self.evictionPolicy.get(self.list, node); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment