Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a generic Cache for other RPCs #18

Open
elliottwilliams opened this issue Sep 5, 2016 · 0 comments
Open

Create a generic Cache for other RPCs #18

elliottwilliams opened this issue Sep 5, 2016 · 0 comments
Labels

Comments

@elliottwilliams
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant