Skip to content

Commit 884144a

Browse files
committed
Expose enable_caching in RuleEvaluationService
1 parent 6b3bb9a commit 884144a

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

python/lib/sift_py/rule_evaluation/service.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,21 @@
3434
class RuleEvaluationService:
3535
"""
3636
A service for evaluating rules. Provides methods to evaluate rules and perform dry-run evaluations.
37+
38+
Args:
39+
enable_caching: Enable caching during rule evaluation. This is enabled by default.
40+
This service is typically short lived in a workflows so assets, channels, and
41+
users are unlikely to change during its lifetime to invalidate caches.
3742
"""
3843

3944
_channel: SiftChannel
4045
_rule_evaluation_stub: RuleEvaluationServiceStub
4146
_rule_service: RuleService
4247

43-
def __init__(self, channel: SiftChannel):
48+
def __init__(self, channel: SiftChannel, enable_caching: bool = True):
4449
self._channel = channel
4550
self._rule_evaluation_stub = RuleEvaluationServiceStub(channel)
46-
47-
# Enable caching during rule evaluation. This service is typically
48-
# short lived in a workflow so assets, channels, and users are unlikely
49-
# to change during its lifetime to invalidate caches.
50-
self._rule_service = RuleService(channel, enable_caching=True)
51+
self._rule_service = RuleService(channel, enable_caching=enable_caching)
5152

5253
def evaluate_against_run(
5354
self,

0 commit comments

Comments
 (0)