且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除缓存破坏在Rails生产

更新时间:2023-01-25 17:58:45

我想你可以使用ENV [ 'RAILS_ASSET_ID']来更改缓存清除资产ID。不幸的是,这是所有资产。

I think you can use ENV['RAILS_ASSET_ID'] to alter the cache-busting asset ID. Unfortunately, this is for all assets.

但是如果没有设置,它将使用资产的源修改时间。如果自上次使用该文件以来,该文件未被修改,则不应该是一个问题。

But if it's not set, it uses the asset's source modification time. If that file hasn't been modified since the last time you used it, it shouldn't be a problem.

如果资产ID没有更改被改变了,可能是因为你的部署过程改变了修改时间,也许你可以看看调整。

If the asset ID is changing when they haven't been changed, it might be because of your deployment process altering the modification time and maybe you could look at tweaking that.

最后,你总是可以使用自己的自定义方法覆盖rails_asset_id

希望这有帮助。