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

Stash checksum and/or timestamp in Redis #21

Closed
mwpastore opened this issue Oct 1, 2015 · 3 comments
Closed

Stash checksum and/or timestamp in Redis #21

mwpastore opened this issue Oct 1, 2015 · 3 comments

Comments

@mwpastore
Copy link

It would be fantastic if ember-deploy-redis would also stash a checksum (or the commit SHA) and/or a build date/time (or the commit timestamp) of the index to use in the the ETag and Last-Modified HTTP headers. Something like:

foo:index:current => '<!DOCTYPE html>...'
foo:index:current:meta => checksum '787b3dd284fd99202adfa4e18a28126d159552c5' 
                          timestamp 'Wed Sep 16 19:28:37 2015 +0200'

And then...

require 'sinatra'
require 'redis'

get '/' do
  content_type 'text/html'
  expires 3_600, :public

  redis = Redis.new
  index_key = redis.get("foo:current")
  index_key = "foo:#{params[:index_key]}" if params[:index_key]

  meta = redis.hgetall("#{index_key}:meta")
  etag meta[:checksum]
  last_modified meta[:timestamp]

  redis.get(index_key)
end

Stashing the content in the same hash as the metadata would be ideal (to limit the Redis hits) but would break backwards compatibility.

@LevelbossMike
Copy link
Owner

Thanks for opening this issue! This sounds like a useful feature! As this plugin will be superseded by https://github.com/ember-cli-deploy/ember-cli-deploy-redis for the new release of ember-cli-deploy I suggest to open an issue on that repository instead though as this is the one that will be actively maintained in the future.

@mwpastore
Copy link
Author

Will do!

@LevelbossMike
Copy link
Owner

Closing in favor of ember-cli-deploy/ember-cli-deploy-redis#37

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

No branches or pull requests

2 participants