-
Notifications
You must be signed in to change notification settings - Fork 2
cache_dir #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
cache_dir #16
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughIntroduces an environment-aware caching mechanism in src/utils/cache.ts with support for disabling caching via DISABLE_CACHE and serverless-aware cache directories. Adds a commented Cache Configuration block to .env.example documenting DISABLE_CACHE. Read/write and maintenance methods now early-return when caching is disabled and handle directory creation fallbacks. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App
participant Env as Env Vars
participant Cache as TopicCache
participant FS as Filesystem
App->>Cache: new TopicCache()
Cache->>Env: Read DISABLE_CACHE, VERCEL/NETLIFY, NODE_ENV
alt DISABLE_CACHE === true
Cache-->>App: cacheDir=""
note right of Cache: Caching disabled\nAll ops become no-ops
else Serverless env detected
Cache->>FS: ensure /tmp/.cache
alt mkdir ok
Cache-->>App: cacheDir="/tmp/.cache"
else mkdir fails
Cache->>FS: ensure /tmp/cache-fallback
alt fallback ok
Cache-->>App: cacheDir="/tmp/cache-fallback"
else fallback fails
Cache-->>App: cacheDir=""
end
end
else Non-serverless
Cache->>FS: ensure ./.cache
alt ok
Cache-->>App: cacheDir="./.cache"
else fail -> fallback flow
Cache->>FS: ensure /tmp/cache-fallback
alt ok
Cache-->>App: cacheDir="/tmp/cache-fallback"
else fail
Cache-->>App: cacheDir=""
end
end
end
App->>Cache: getManimCode(key)
alt cacheDir=="" or file missing/expired
Cache-->>App: null
else
Cache->>FS: read file
Cache-->>App: data
end
App->>Cache: setManimCode(key, data)
alt cacheDir==""
Cache-->>App: no-op (log)
else
Cache->>FS: write file
Cache-->>App: done
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (34)
📒 Files selected for processing (2)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor