vfbquery 0.3.4__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vfbquery-0.3.4 → vfbquery-0.4.0}/PKG-INFO +6 -6
- {vfbquery-0.3.4 → vfbquery-0.4.0}/README.md +6 -6
- {vfbquery-0.3.4 → vfbquery-0.4.0}/setup.py +1 -1
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/test/term_info_queries_test.py +58 -0
- vfbquery-0.4.0/src/test/test_default_caching.py +173 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/test/test_examples_diff.py +6 -1
- vfbquery-0.4.0/src/vfbquery/__init__.py +65 -0
- vfbquery-0.4.0/src/vfbquery/cache_enhancements.py +465 -0
- vfbquery-0.4.0/src/vfbquery/cached_functions.py +227 -0
- vfbquery-0.4.0/src/vfbquery/solr_cache_integration.py +212 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery/solr_fetcher.py +47 -3
- vfbquery-0.4.0/src/vfbquery/solr_result_cache.py +613 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery/vfb_queries.py +268 -46
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery.egg-info/PKG-INFO +6 -6
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery.egg-info/SOURCES.txt +5 -0
- vfbquery-0.3.4/src/vfbquery/__init__.py +0 -4
- {vfbquery-0.3.4 → vfbquery-0.4.0}/LICENSE +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/pyproject.toml +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/setup.cfg +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/test/__init__.py +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/test/readme_parser.py +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery/term_info_queries.py +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery/test_utils.py +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery.egg-info/dependency_links.txt +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery.egg-info/requires.txt +0 -0
- {vfbquery-0.3.4 → vfbquery-0.4.0}/src/vfbquery.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: vfbquery
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Wrapper for querying VirtualFlyBrain knowledge graph.
|
|
5
5
|
Home-page: https://github.com/VirtualFlyBrain/VFBquery
|
|
6
6
|
Author: VirtualFlyBrain
|
|
@@ -117,25 +117,25 @@ vfb.get_term_info('FBbt_00003748')
|
|
|
117
117
|
"id": "VFB_00102107",
|
|
118
118
|
"label": "[ME on JRC2018Unisex adult brain](VFB_00102107)",
|
|
119
119
|
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
120
|
-
"thumbnail": "[](VFB_00101567,VFB_00102107)"
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
"id": "VFB_00101385",
|
|
124
124
|
"label": "[ME%28R%29 on JRC_FlyEM_Hemibrain](VFB_00101385)",
|
|
125
125
|
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
126
|
-
"thumbnail": "[ on JRC_FlyEM_Hemibrain aligned to JRC_FlyEM_Hemibrain')](VFB_00101384,VFB_00101385)"
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"id": "VFB_00030810",
|
|
130
130
|
"label": "[medulla on adult brain template Ito2014](VFB_00030810)",
|
|
131
|
-
"tags": "Nervous_system|Visual_system|
|
|
131
|
+
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
132
132
|
"thumbnail": "[](VFB_00030786,VFB_00030810)"
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"id": "VFB_00030624",
|
|
136
136
|
"label": "[medulla on adult brain template JFRC2](VFB_00030624)",
|
|
137
|
-
"tags": "Nervous_system|Visual_system|
|
|
138
|
-
"thumbnail": "[](VFB_00017894,VFB_00030624)"
|
|
137
|
+
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
138
|
+
"thumbnail": "[](VFB_00017894,VFB_00030624)"
|
|
139
139
|
}
|
|
140
140
|
]
|
|
141
141
|
},
|
|
@@ -97,25 +97,25 @@ vfb.get_term_info('FBbt_00003748')
|
|
|
97
97
|
"id": "VFB_00102107",
|
|
98
98
|
"label": "[ME on JRC2018Unisex adult brain](VFB_00102107)",
|
|
99
99
|
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
100
|
-
"thumbnail": "[](VFB_00101567,VFB_00102107)"
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"id": "VFB_00101385",
|
|
104
104
|
"label": "[ME%28R%29 on JRC_FlyEM_Hemibrain](VFB_00101385)",
|
|
105
105
|
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
106
|
-
"thumbnail": "[ on JRC_FlyEM_Hemibrain aligned to JRC_FlyEM_Hemibrain')](VFB_00101384,VFB_00101385)"
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
"id": "VFB_00030810",
|
|
110
110
|
"label": "[medulla on adult brain template Ito2014](VFB_00030810)",
|
|
111
|
-
"tags": "Nervous_system|Visual_system|
|
|
111
|
+
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
112
112
|
"thumbnail": "[](VFB_00030786,VFB_00030810)"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"id": "VFB_00030624",
|
|
116
116
|
"label": "[medulla on adult brain template JFRC2](VFB_00030624)",
|
|
117
|
-
"tags": "Nervous_system|Visual_system|
|
|
118
|
-
"thumbnail": "[](VFB_00017894,VFB_00030624)"
|
|
117
|
+
"tags": "Nervous_system|Adult|Visual_system|Synaptic_neuropil_domain",
|
|
118
|
+
"thumbnail": "[](VFB_00017894,VFB_00030624)"
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
121
|
},
|
|
@@ -1292,4 +1292,4 @@ vfb.get_templates(return_dataframe=False)
|
|
|
1292
1292
|
],
|
|
1293
1293
|
"count": 10
|
|
1294
1294
|
}
|
|
1295
|
-
```
|
|
1295
|
+
```
|
|
@@ -524,6 +524,64 @@ class TermInfoQueriesTest(unittest.TestCase):
|
|
|
524
524
|
self.assertFalse("filemeta" in serialized)
|
|
525
525
|
self.assertFalse("template" in serialized)
|
|
526
526
|
|
|
527
|
+
def test_term_info_performance(self):
|
|
528
|
+
"""
|
|
529
|
+
Performance test for specific term info queries.
|
|
530
|
+
Tests the execution time for FBbt_00003748 and VFB_00101567.
|
|
531
|
+
"""
|
|
532
|
+
import vfbquery as vfb
|
|
533
|
+
|
|
534
|
+
# Test performance for FBbt_00003748 (mushroom body)
|
|
535
|
+
start_time = time.time()
|
|
536
|
+
result_1 = vfb.get_term_info('FBbt_00003748')
|
|
537
|
+
duration_1 = time.time() - start_time
|
|
538
|
+
|
|
539
|
+
# Test performance for VFB_00101567 (individual anatomy)
|
|
540
|
+
start_time = time.time()
|
|
541
|
+
result_2 = vfb.get_term_info('VFB_00101567')
|
|
542
|
+
duration_2 = time.time() - start_time
|
|
543
|
+
|
|
544
|
+
# Print performance metrics for GitHub Actions logs
|
|
545
|
+
print(f"\n" + "="*50)
|
|
546
|
+
print(f"Performance Test Results:")
|
|
547
|
+
print(f"="*50)
|
|
548
|
+
print(f"FBbt_00003748 query took: {duration_1:.4f} seconds")
|
|
549
|
+
print(f"VFB_00101567 query took: {duration_2:.4f} seconds")
|
|
550
|
+
print(f"Total time for both queries: {duration_1 + duration_2:.4f} seconds")
|
|
551
|
+
|
|
552
|
+
# Performance categories
|
|
553
|
+
total_time = duration_1 + duration_2
|
|
554
|
+
if total_time < 1.0:
|
|
555
|
+
performance_level = "🟢 Excellent (< 1 second)"
|
|
556
|
+
elif total_time < 2.0:
|
|
557
|
+
performance_level = "🟡 Good (1-2 seconds)"
|
|
558
|
+
elif total_time < 4.0:
|
|
559
|
+
performance_level = "🟠 Acceptable (2-4 seconds)"
|
|
560
|
+
else:
|
|
561
|
+
performance_level = "🔴 Slow (> 4 seconds)"
|
|
562
|
+
|
|
563
|
+
print(f"Performance Level: {performance_level}")
|
|
564
|
+
print(f"="*50)
|
|
565
|
+
|
|
566
|
+
# Basic assertions to ensure the queries succeeded
|
|
567
|
+
self.assertIsNotNone(result_1, "FBbt_00003748 query returned None")
|
|
568
|
+
self.assertIsNotNone(result_2, "VFB_00101567 query returned None")
|
|
569
|
+
|
|
570
|
+
# Performance assertions - fail if queries take too long
|
|
571
|
+
# These thresholds are based on observed performance characteristics
|
|
572
|
+
max_single_query_time = 2.0 # seconds
|
|
573
|
+
max_total_time = 4.0 # seconds (2 queries * 2 seconds each)
|
|
574
|
+
|
|
575
|
+
self.assertLess(duration_1, max_single_query_time,
|
|
576
|
+
f"FBbt_00003748 query took {duration_1:.4f}s, exceeding {max_single_query_time}s threshold")
|
|
577
|
+
self.assertLess(duration_2, max_single_query_time,
|
|
578
|
+
f"VFB_00101567 query took {duration_2:.4f}s, exceeding {max_single_query_time}s threshold")
|
|
579
|
+
self.assertLess(duration_1 + duration_2, max_total_time,
|
|
580
|
+
f"Total query time {duration_1 + duration_2:.4f}s exceeds {max_total_time}s threshold")
|
|
581
|
+
|
|
582
|
+
# Log success
|
|
583
|
+
print("Performance test completed successfully!")
|
|
584
|
+
|
|
527
585
|
|
|
528
586
|
class TestVariable:
|
|
529
587
|
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test VFBquery default caching functionality.
|
|
3
|
+
|
|
4
|
+
These tests ensure that the default 3-month TTL, 2GB memory caching
|
|
5
|
+
system works correctly and provides expected performance benefits.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import unittest
|
|
9
|
+
import os
|
|
10
|
+
import time
|
|
11
|
+
from unittest.mock import MagicMock
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
# Mock vispy imports before importing vfbquery
|
|
15
|
+
for module in ['vispy', 'vispy.scene', 'vispy.util', 'vispy.util.fonts',
|
|
16
|
+
'vispy.util.fonts._triage', 'vispy.util.fonts._quartz',
|
|
17
|
+
'vispy.ext', 'vispy.ext.cocoapy', 'navis', 'navis.plotting',
|
|
18
|
+
'navis.plotting.vispy', 'navis.plotting.vispy.viewer']:
|
|
19
|
+
sys.modules[module] = MagicMock()
|
|
20
|
+
|
|
21
|
+
# Set environment variables
|
|
22
|
+
os.environ.update({
|
|
23
|
+
'MPLBACKEND': 'Agg',
|
|
24
|
+
'VISPY_GL_LIB': 'osmesa',
|
|
25
|
+
'VISPY_USE_EGL': '0',
|
|
26
|
+
'VFBQUERY_CACHE_ENABLED': 'true'
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestDefaultCaching(unittest.TestCase):
|
|
31
|
+
"""Test default caching behavior in VFBquery."""
|
|
32
|
+
|
|
33
|
+
def setUp(self):
|
|
34
|
+
"""Set up test environment."""
|
|
35
|
+
# Clear any existing cache before each test
|
|
36
|
+
try:
|
|
37
|
+
import vfbquery
|
|
38
|
+
if hasattr(vfbquery, 'clear_vfbquery_cache'):
|
|
39
|
+
vfbquery.clear_vfbquery_cache()
|
|
40
|
+
except ImportError:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
def test_caching_enabled_by_default(self):
|
|
44
|
+
"""Test that caching is automatically enabled when importing vfbquery."""
|
|
45
|
+
import vfbquery
|
|
46
|
+
|
|
47
|
+
# Check that caching functions are available
|
|
48
|
+
self.assertTrue(hasattr(vfbquery, 'get_vfbquery_cache_stats'))
|
|
49
|
+
self.assertTrue(hasattr(vfbquery, 'enable_vfbquery_caching'))
|
|
50
|
+
|
|
51
|
+
# Check that cache stats show caching is enabled
|
|
52
|
+
stats = vfbquery.get_vfbquery_cache_stats()
|
|
53
|
+
self.assertTrue(stats['enabled'])
|
|
54
|
+
self.assertEqual(stats['cache_ttl_days'], 90.0) # 3 months
|
|
55
|
+
self.assertEqual(stats['memory_cache_limit_mb'], 2048) # 2GB
|
|
56
|
+
|
|
57
|
+
def test_cache_performance_improvement(self):
|
|
58
|
+
"""Test that caching provides performance improvement."""
|
|
59
|
+
import vfbquery
|
|
60
|
+
|
|
61
|
+
test_term = 'FBbt_00003748' # medulla
|
|
62
|
+
|
|
63
|
+
# First call (cold - populates cache)
|
|
64
|
+
start_time = time.time()
|
|
65
|
+
result1 = vfbquery.get_term_info(test_term)
|
|
66
|
+
cold_time = time.time() - start_time
|
|
67
|
+
|
|
68
|
+
# Verify we got a result
|
|
69
|
+
self.assertIsNotNone(result1)
|
|
70
|
+
if result1 is not None:
|
|
71
|
+
self.assertIn('Name', result1)
|
|
72
|
+
|
|
73
|
+
# Second call (warm - should hit cache)
|
|
74
|
+
start_time = time.time()
|
|
75
|
+
result2 = vfbquery.get_term_info(test_term)
|
|
76
|
+
warm_time = time.time() - start_time
|
|
77
|
+
|
|
78
|
+
# Verify cache hit
|
|
79
|
+
self.assertIsNotNone(result2)
|
|
80
|
+
self.assertEqual(result1, result2) # Should be identical
|
|
81
|
+
|
|
82
|
+
# Verify performance improvement (warm should be faster)
|
|
83
|
+
self.assertLess(warm_time, cold_time)
|
|
84
|
+
|
|
85
|
+
# Check cache statistics
|
|
86
|
+
stats = vfbquery.get_vfbquery_cache_stats()
|
|
87
|
+
self.assertGreater(stats['hits'], 0) # Should have cache hits
|
|
88
|
+
self.assertGreater(stats['hit_rate_percent'], 0) # Positive hit rate
|
|
89
|
+
|
|
90
|
+
def test_cache_statistics_tracking(self):
|
|
91
|
+
"""Test that cache statistics are properly tracked."""
|
|
92
|
+
import vfbquery
|
|
93
|
+
|
|
94
|
+
# Clear cache and get fresh baseline
|
|
95
|
+
vfbquery.clear_vfbquery_cache()
|
|
96
|
+
initial_stats = vfbquery.get_vfbquery_cache_stats()
|
|
97
|
+
initial_items = initial_stats['memory_cache_items']
|
|
98
|
+
initial_total = initial_stats['misses'] + initial_stats['hits']
|
|
99
|
+
|
|
100
|
+
# Make a unique query that won't be cached
|
|
101
|
+
unique_term = 'FBbt_00005106' # Use a different term
|
|
102
|
+
result = vfbquery.get_term_info(unique_term)
|
|
103
|
+
self.assertIsNotNone(result)
|
|
104
|
+
|
|
105
|
+
# Check that stats were updated
|
|
106
|
+
updated_stats = vfbquery.get_vfbquery_cache_stats()
|
|
107
|
+
updated_total = updated_stats['misses'] + updated_stats['hits']
|
|
108
|
+
|
|
109
|
+
self.assertGreaterEqual(updated_stats['memory_cache_items'], initial_items)
|
|
110
|
+
self.assertGreater(updated_total, initial_total) # More total requests
|
|
111
|
+
self.assertGreaterEqual(updated_stats['memory_cache_size_mb'], 0)
|
|
112
|
+
|
|
113
|
+
def test_memory_size_tracking(self):
|
|
114
|
+
"""Test that memory usage is properly tracked."""
|
|
115
|
+
import vfbquery
|
|
116
|
+
|
|
117
|
+
# Clear cache to start fresh
|
|
118
|
+
vfbquery.clear_vfbquery_cache()
|
|
119
|
+
|
|
120
|
+
# Cache a few different terms
|
|
121
|
+
test_terms = ['FBbt_00003748', 'VFB_00101567']
|
|
122
|
+
|
|
123
|
+
for term in test_terms:
|
|
124
|
+
vfbquery.get_term_info(term)
|
|
125
|
+
stats = vfbquery.get_vfbquery_cache_stats()
|
|
126
|
+
|
|
127
|
+
# Memory size should be tracked
|
|
128
|
+
self.assertGreaterEqual(stats['memory_cache_size_mb'], 0)
|
|
129
|
+
self.assertLessEqual(stats['memory_cache_size_mb'], stats['memory_cache_limit_mb'])
|
|
130
|
+
|
|
131
|
+
def test_cache_ttl_configuration(self):
|
|
132
|
+
"""Test that cache TTL is properly configured."""
|
|
133
|
+
import vfbquery
|
|
134
|
+
|
|
135
|
+
stats = vfbquery.get_vfbquery_cache_stats()
|
|
136
|
+
|
|
137
|
+
# Should be configured for 3 months (90 days)
|
|
138
|
+
self.assertEqual(stats['cache_ttl_days'], 90.0)
|
|
139
|
+
self.assertEqual(stats['cache_ttl_hours'], 2160) # 90 * 24
|
|
140
|
+
|
|
141
|
+
def test_transparent_caching(self):
|
|
142
|
+
"""Test that regular VFBquery functions are transparently cached."""
|
|
143
|
+
import vfbquery
|
|
144
|
+
|
|
145
|
+
# Test that get_term_info and get_instances are using cached versions
|
|
146
|
+
test_term = 'FBbt_00003748'
|
|
147
|
+
|
|
148
|
+
# These should work with caching transparently
|
|
149
|
+
term_info = vfbquery.get_term_info(test_term)
|
|
150
|
+
self.assertIsNotNone(term_info)
|
|
151
|
+
|
|
152
|
+
instances = vfbquery.get_instances(test_term, limit=5)
|
|
153
|
+
self.assertIsNotNone(instances)
|
|
154
|
+
|
|
155
|
+
# Cache should show activity
|
|
156
|
+
stats = vfbquery.get_vfbquery_cache_stats()
|
|
157
|
+
self.assertGreater(stats['misses'] + stats['hits'], 0)
|
|
158
|
+
|
|
159
|
+
def test_cache_disable_environment_variable(self):
|
|
160
|
+
"""Test that caching can be disabled via environment variable."""
|
|
161
|
+
# This test would need to be run in a separate process to test
|
|
162
|
+
# the environment variable behavior at import time
|
|
163
|
+
# For now, just verify the current state respects the env var
|
|
164
|
+
|
|
165
|
+
cache_enabled = os.getenv('VFBQUERY_CACHE_ENABLED', 'true').lower()
|
|
166
|
+
if cache_enabled not in ('false', '0', 'no', 'off'):
|
|
167
|
+
import vfbquery
|
|
168
|
+
stats = vfbquery.get_vfbquery_cache_stats()
|
|
169
|
+
self.assertTrue(stats['enabled'])
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if __name__ == '__main__':
|
|
173
|
+
unittest.main(verbosity=2)
|
|
@@ -113,7 +113,12 @@ def remove_nulls(data):
|
|
|
113
113
|
new_dict[k] = cleaned
|
|
114
114
|
return new_dict
|
|
115
115
|
elif isinstance(data, list):
|
|
116
|
-
|
|
116
|
+
filtered = []
|
|
117
|
+
for item in data:
|
|
118
|
+
cleaned_item = remove_nulls(item)
|
|
119
|
+
if cleaned_item is not None and cleaned_item != {} and cleaned_item != []:
|
|
120
|
+
filtered.append(cleaned_item)
|
|
121
|
+
return filtered
|
|
117
122
|
return data
|
|
118
123
|
|
|
119
124
|
def main():
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from .vfb_queries import *
|
|
2
|
+
|
|
3
|
+
# Caching enhancements (optional import - don't break if dependencies missing)
|
|
4
|
+
try:
|
|
5
|
+
from .cache_enhancements import (
|
|
6
|
+
enable_vfbquery_caching,
|
|
7
|
+
disable_vfbquery_caching,
|
|
8
|
+
clear_vfbquery_cache,
|
|
9
|
+
get_vfbquery_cache_stats,
|
|
10
|
+
set_cache_ttl,
|
|
11
|
+
set_cache_memory_limit,
|
|
12
|
+
set_cache_max_items,
|
|
13
|
+
enable_disk_cache,
|
|
14
|
+
disable_disk_cache,
|
|
15
|
+
get_cache_config,
|
|
16
|
+
CacheConfig
|
|
17
|
+
)
|
|
18
|
+
from .cached_functions import (
|
|
19
|
+
get_term_info_cached,
|
|
20
|
+
get_instances_cached,
|
|
21
|
+
patch_vfbquery_with_caching,
|
|
22
|
+
unpatch_vfbquery_caching
|
|
23
|
+
)
|
|
24
|
+
__caching_available__ = True
|
|
25
|
+
|
|
26
|
+
# Enable caching by default with 3-month TTL and 2GB memory cache
|
|
27
|
+
import os
|
|
28
|
+
|
|
29
|
+
# Check if caching should be disabled via environment variable
|
|
30
|
+
cache_disabled = os.getenv('VFBQUERY_CACHE_ENABLED', 'true').lower() in ('false', '0', 'no', 'off')
|
|
31
|
+
|
|
32
|
+
if not cache_disabled:
|
|
33
|
+
# Enable caching with VFB_connect-like defaults
|
|
34
|
+
enable_vfbquery_caching(
|
|
35
|
+
cache_ttl_hours=2160, # 3 months (90 days)
|
|
36
|
+
memory_cache_size_mb=2048, # 2GB memory cache
|
|
37
|
+
max_items=10000, # Max 10k items as safeguard
|
|
38
|
+
disk_cache_enabled=True # Persistent across sessions
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Automatically patch existing functions for transparent caching
|
|
42
|
+
patch_vfbquery_with_caching()
|
|
43
|
+
|
|
44
|
+
print("VFBquery: Caching enabled by default (3-month TTL, 2GB memory)")
|
|
45
|
+
print(" Disable with: export VFBQUERY_CACHE_ENABLED=false")
|
|
46
|
+
|
|
47
|
+
except ImportError:
|
|
48
|
+
__caching_available__ = False
|
|
49
|
+
print("VFBquery: Caching not available (dependencies missing)")
|
|
50
|
+
|
|
51
|
+
# SOLR-based result caching (experimental - for cold start optimization)
|
|
52
|
+
try:
|
|
53
|
+
from .solr_cache_integration import (
|
|
54
|
+
enable_solr_result_caching,
|
|
55
|
+
disable_solr_result_caching,
|
|
56
|
+
warmup_solr_cache,
|
|
57
|
+
get_solr_cache_stats as get_solr_cache_stats_func,
|
|
58
|
+
cleanup_solr_cache
|
|
59
|
+
)
|
|
60
|
+
__solr_caching_available__ = True
|
|
61
|
+
except ImportError:
|
|
62
|
+
__solr_caching_available__ = False
|
|
63
|
+
|
|
64
|
+
# Version information
|
|
65
|
+
__version__ = "0.4.0"
|