ember-cli-deploy / ember-cli-deploy/ember-cli-deploy-redis

Stash checksum and/or timestamp in Redis

未关闭
#37 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
17
派生
40
PR 合并指标
30 天内没有已合并 PR

描述

Similar to #25, 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 => '...'
foo:index:current:meta => checksum '787b3dd284fd99202adfa4e18a28126d159552c5'
timestamp 'Wed Sep 16 19:28:37 2015 +0200'
```

And then...

``` ruby
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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。