Sha256: e9ef0ab44ed41ebdabd58ca16c7efdd14b0d2ca01a587e1d95e911235ad15874
Contents?: true
Size: 725 Bytes
Versions: 2
Compression:
Stored size: 725 Bytes
Contents
module Determinator module Retrieve # Middleware which indexes features by their name, so we can look up a feature by name # and find the details (which are only accessible by ID) class RoutemasterIndexingMiddleware def initialize(app) @app = app end def call(env) content = JSON.parse(env.body) if content_describes_feature?(content) key = Routemaster.index_cache_key(content['name']) ::Routemaster::Config.cache_redis.set(key, content['id']) end @app.call(env) end private def content_describes_feature?(content) content['id'] && content['name'] && content['bucket_type'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
determinator-0.1.1 | lib/determinator/retrieve/routemaster_indexing_middleware.rb |
determinator-0.1.0 | lib/determinator/retrieve/routemaster_indexing_middleware.rb |