Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FIFO (First-In-First-Out) Cache Policy Implementation #13

Open
0xnullifier opened this issue Dec 16, 2024 · 0 comments
Open

Add FIFO (First-In-First-Out) Cache Policy Implementation #13

0xnullifier opened this issue Dec 16, 2024 · 0 comments
Labels
enhancement New feature or request medium Oh you have some experience with programming huh! Come on solve this then

Comments

@0xnullifier
Copy link
Collaborator

What is FIFO?

  • FIFO is a cache policy where the first item added to the cache is the first one to be removed when space is needed

Here are the is what you will do:

  1. Create a new struct FIFOCachePolicy that implements the CachePolicy interface
  2. Track order of insertion using a slice or linked list to maintain FIFO order. You can use external libraries to for datastrucutres if you wish to use some.
  3. Implement both required methods:
    • Eject(m *Memoria, requiredSpace uint64) error
    • Insert(m *Memoria, key string, val []byte) error

Example :

type FIFOCachePolicy struct {
    order []string  
   queue *queue
}
@0xnullifier 0xnullifier added enhancement New feature or request medium Oh you have some experience with programming huh! Come on solve this then labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium Oh you have some experience with programming huh! Come on solve this then
Projects
None yet
Development

No branches or pull requests

1 participant