-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Other RPCs could benefit from cache: agency.* could remember lists of routes and stations before they're fetched (which is a very expensive call). Yet-to-be-implemented Schedule RPCs could retain schedule information without having to fetch.
This issue extends the infrastructure used by LastEventCache into a generic Cache with the following methods:
Cache.lookup(rpc:args:kwargs:) -> TopicEvent?
Selects a cache for this particularrpc, and returns a storedTopicEventif one exists matching the call argument.Cache.store(rpc:args:kwargs:event:) -> Bool
Selects a cache forrpc, and attempts to persist `event.Cache.void(rpc:event:)
Voids a storedeventin the cache forrpc.
RPC-specific caches will implement a protocol with corresponding methods, as well as a test to determine if they accept a particular RPC. They can then be wired into a Connection.call middleware stack which tries each cache in order before trying the WAMP connection.