File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,19 @@ def reset_hash(self):
128128 """Reset the block hash when the block is evicted."""
129129 self ._block_hash = None
130130
131+ def __repr__ (self ) -> str :
132+ # Use block_id instead of KVCacheBlock object to avoid calling __repr__
133+ # on KVCacheBlock object recursively.
134+ prev_block_id = self .prev_free_block .block_id \
135+ if self .prev_free_block else None
136+ next_block_id = self .next_free_block .block_id \
137+ if self .next_free_block else None
138+ return (f"KVCacheBlock(block_id={ self .block_id } , "
139+ f"ref_cnt={ self .ref_cnt } , "
140+ f"_block_hash={ self ._block_hash } , "
141+ f"prev_free_block={ prev_block_id } , "
142+ f"next_free_block={ next_block_id } )" )
143+
131144
132145class FreeKVCacheBlockQueue :
133146 """This class organizes a list of KVCacheBlock objects to a doubly linked
You can’t perform that action at this time.
0 commit comments