Cache

source: bluebase/pf/cache.py


class PfPageCache(page_size: int, capacity: int, replacer: PfReplacer)[source]

Bases: object

page cache를 관리하는 클래스입니다.

Variables:
  • page_size (int) – page의 크기.

  • capacity (int) – cache의 용량.

  • replacer (PfReplacer) – cache가 사용하는 교체 정책.

  • entries (dict[PfEntryId, PfPage]) – cache가 관리하는 entry들.

optional_evict() → None[source]

Hint

이런 함수가 있으면 편하다!

is_full() → bool[source]
get_page_offset(pid: PfPageId) → int[source]
assignmentread(file: PfFile, pid: PfPageId) → PfPage[source]
Raises:

PfInvalidPageDataSizeError –

assignmentwrite(page: PfPage, *, fsync: bool = False) → None[source]
Raises:

PfInvalidPageDataSizeError –

assignmentfetch(file: PfFile, pid: PfPageId) → PfPage[source]
Raises:

PfNoEvictableEntryError –

assignmentacquire(file: PfFile, pid: PfPageId) → PfPage[source]
Raises:

PfNoEvictableEntryError –

assignmenttouch(page: PfPage) → None[source]
assignmentpersist(file: PfFile) → None[source]
assignmentflush(file: PfFile) → None[source]
Raises:

PfPinnedPageFlushError –