mirror of
https://github.com/ltcptgeneral/cs239-caching.git
synced 2025-04-13 17:07:24 +00:00
fix python docstring
This commit is contained in:
parent
6234e88265
commit
dda79a9a61
8
cache.py
8
cache.py
@ -2,24 +2,24 @@ from abc import ABC, abstractmethod
|
|||||||
|
|
||||||
# implements a simple string k-v store, objects should be serialized before putting into the cache
|
# implements a simple string k-v store, objects should be serialized before putting into the cache
|
||||||
class Cache(ABC):
|
class Cache(ABC):
|
||||||
# constructor taking in the cache size limit as number of entries
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self, limit: int):
|
def __init__(self, limit: int):
|
||||||
|
"""Constructor taking in the cache size limit as number of entries"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# get the value corresponding to key or returns None if there was a cache miss
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get(self, key: str) -> str:
|
def get(self, key: str) -> str:
|
||||||
|
"""Get the value corresponding to key or returns None if there was a cache miss"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# set the value corresponding to key and returns True if an eviction was made
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def put(self, key: str, val: str) -> bool:
|
def put(self, key: str, val: str) -> bool:
|
||||||
|
"""Set the value corresponding to key and returns True if an eviction was made"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# mark cache item as invalid and returns True if the element was found and invalidated
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def invalidate(self, key: str) -> bool:
|
def invalidate(self, key: str) -> bool:
|
||||||
|
"""Mark cache item as invalid and returns True if the element was found and invalidated"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
Loading…
x
Reference in New Issue
Block a user