Skip to content

Commit c2b3ae1

Browse files
committed
refactor(cache): cleanup expired cache entries during update operations
Signed-off-by: QIN2DIM <[email protected]>
1 parent 1cbbf55 commit c2b3ae1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ This Docker Compose configuration allows you to quickly run Semantic Router + En
1111

1212
1. **Clone the repository and navigate to the project directory**
1313
```bash
14-
git clone <repository-url>
15-
cd semantic_router
14+
git clone https://github.com/vllm-project/semantic-router.git
15+
cd semantic-router
1616
```
1717

1818
2. **Download required models** (if not already present):

src/semantic-router/pkg/cache/cache.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ func (c *SemanticCache) UpdateWithResponse(query string, responseBody []byte) er
108108
c.mu.Lock()
109109
defer c.mu.Unlock()
110110

111+
// Cleanup expired entries while we have the write lock
112+
c.cleanupExpiredEntries()
113+
111114
// Find the pending request by query
112115
for i, entry := range c.entries {
113116
if entry.Query == query && entry.ResponseBody == nil {

0 commit comments

Comments
 (0)