MCPcopy Create free account
hub / github.com/PyTables/PyTables / restorecache

Method restorecache

tables/index.py:2100–2137  ·  view source on GitHub ↗

Clean the limits cache and resize starts and lengths arrays.

(self)

Source from the content-addressed store, hash-verified

2098 return self.nelements
2099
2100 def restorecache(self) -> None:
2101 """Clean the limits cache and resize starts and lengths arrays."""
2102 params = self._v_file.params
2103 # The sorted IndexArray is absolutely required to be in memory
2104 # at the same time as the Index instance, so create a strong
2105 # reference to it. We are not introducing leaks because the
2106 # strong reference will disappear when this Index instance is
2107 # to be closed.
2108 self._sorted = self.sorted
2109 self._sorted.boundscache = ObjectCache(
2110 params["BOUNDS_MAX_SLOTS"],
2111 params["BOUNDS_MAX_SIZE"],
2112 "non-opt types bounds",
2113 )
2114 self.sorted.boundscache = ObjectCache(
2115 params["BOUNDS_MAX_SLOTS"],
2116 params["BOUNDS_MAX_SIZE"],
2117 "non-opt types bounds",
2118 )
2119 """A cache for the bounds (2nd hash) data. Only used for
2120 non-optimized types searches."""
2121 self.limboundscache = ObjectCache(
2122 params["LIMBOUNDS_MAX_SLOTS"],
2123 params["LIMBOUNDS_MAX_SIZE"],
2124 "bounding limits",
2125 )
2126 """A cache for bounding limits."""
2127 self.sortedLRcache = ObjectCache(
2128 params["SORTEDLR_MAX_SLOTS"],
2129 params["SORTEDLR_MAX_SIZE"],
2130 "last row chunks",
2131 )
2132 """A cache for the last row chunks. Only used for searches in
2133 the last row, and mainly useful for small indexes."""
2134 self.starts = np.empty(shape=self.nrows, dtype=np.int32)
2135 self.lengths = np.empty(shape=self.nrows, dtype=np.int32)
2136 self.sorted._init_sorted_slice(self)
2137 self.dirtycache = False
2138
2139 def search(self, item: tuple[float, float]) -> int:
2140 """Do a binary search in this index for an item."""

Callers 1

searchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected