Skip to content

Caching mechanism - #187

Merged
ddelpiano merged 19 commits into
developmentfrom
feature/cache_mech
Sep 4, 2025
Merged

Caching mechanism#187
ddelpiano merged 19 commits into
developmentfrom
feature/cache_mech

Conversation

@ddelpiano

Copy link
Copy Markdown
Member

No description provided.

@ddelpiano
ddelpiano requested a review from Copilot September 3, 2025 13:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a disk-based caching mechanism for the Virtual Fly Brain backend to improve performance by reducing API calls to vfbquery. The caching system uses TTL (time-to-live) expiration and includes automated cleanup via cron jobs.

  • Adds disk-based caching for term info and query results with 3-day TTL
  • Implements cache management utilities with cleanup automation
  • Includes various frontend code improvements and optimizations
  • Reduces resource allocation for the deployment

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
applications/virtual-fly-brain/backend/virtual_fly_brain/services/cache_utils.py Core caching implementation with DiskCache class
applications/virtual-fly-brain/backend/virtual_fly_brain/services/term_info.py Updated term info service with caching integration
applications/virtual-fly-brain/backend/virtual_fly_brain/services/queries.py Updated queries service with caching integration
applications/virtual-fly-brain/backend/virtual_fly_brain/services/cache_manager.py Command-line utility for cache management and statistics
applications/virtual-fly-brain/Dockerfile Adds cron service and cache cleanup automation
applications/virtual-fly-brain/backend/docker-entrypoint.sh Entrypoint script for Docker container setup
applications/virtual-fly-brain/backend/vfb_cache_cleanup.sh Shell script for automated cache cleanup
applications/virtual-fly-brain/deploy/values.yaml Reduces resource allocation for deployment
applications/virtual-fly-brain/frontend/src/components/StackViewerComponent.jsx Improves text handling and memory management
Multiple frontend files Various code cleanup, unused import removal, and styling fixes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread applications/virtual-fly-brain/frontend/src/components/queryBuilder/Query.jsx Outdated
Comment on lines +150 to +155
// Merge with existing tags, preserving active state for existing ones
const prevTagsMap = new Map(prevTags.map(tag => [tag.label, tag.active]));
return calculatedChipTags.map(newTag => ({
...newTag,
active: prevTagsMap.has(newTag.label) ? prevTagsMap.get(newTag.label) : true
}));

Copilot AI Sep 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Map creation and mapping operations are performed inside useEffect on every calculatedChipTags change. Consider using useMemo for the prevTagsMap creation to optimize performance when calculatedChipTags changes frequently.

Copilot uses AI. Check for mistakes.
Comment thread applications/virtual-fly-brain/backend/virtual_fly_brain/services/cache_utils.py Outdated
Comment thread applications/virtual-fly-brain/frontend/src/components/StackViewerComponent.jsx Outdated
@ddelpiano
ddelpiano merged commit 43bda24 into development Sep 4, 2025
2 checks passed
Robbie1977 pushed a commit to VirtualFlyBrain/virtual-fly-brain that referenced this pull request Jan 26, 2026
Robbie1977 pushed a commit to VirtualFlyBrain/virtual-fly-brain that referenced this pull request Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants