Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions flask4modelcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import asyncio

from flask import Flask, request, jsonify
from modelcache import cache
from modelcache.cache import Cache
from modelcache.embedding import EmbeddingModel

Expand Down Expand Up @@ -42,6 +43,11 @@ def user_backend():
return jsonify(result), 500

await asyncio.to_thread(app.run, host='0.0.0.0', port=5000)

@app.route('/modelcache/ttl_stats', methods=['GET'])
def ttl_stats():
stats = cache.data_manager.ttl_manager.stats()
return jsonify({"status": "ok", "data": stats})


if __name__ == '__main__':
Expand Down
Loading