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 particular rpc, and returns a stored TopicEvent if one exists matching the call argument.
Cache.store(rpc:args:kwargs:event:) -> Bool
Selects a cache for rpc, and attempts to persist `event.
Cache.void(rpc:event:)
Voids a stored event in the cache for rpc.
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.
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
LastEventCacheinto a genericCachewith the following methods:Cache.lookup(rpc:args:kwargs:) -> TopicEvent?Selects a cache for this particular
rpc, and returns a storedTopicEventif one exists matching the call argument.Cache.store(rpc:args:kwargs:event:) -> BoolSelects a cache for
rpc, and attempts to persist `event.Cache.void(rpc:event:)Voids a stored
eventin 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.callmiddleware stack which tries each cache in order before trying the WAMP connection.