Closed saiqulhaq closed 5 years ago
default asset's cache key should not id
but try to call :cache_key
method, or use id
as fallback
then cache key could be like datagrid_class.to_s/column.name/column.type/cache_key/
to prevent collision
because in my app, I have multiple datagrid class for a model
This feature is used for a different type of problem.
The thing you are proposing is something to consider. I personally don't think it is that important to have it built in into datagrid. I even doubt that the current caching functionality was a good idea.
If we would do that, we would need to support expiration conditions: not all of the columns can be cached with the same cache key like:
column(:number_of_posts) do |forum|
forum.posts.where(published: true).count
end
I doubt such cache can be used for non-trivial column values and caching itself is required in those non-trivial ones.
ok make sense
as the title says, cache is not working as expected
why don't use rails fragment cache?
I read the source code, caching is done by
@cache = {}
only it's a Hash object, which is not persistentI have tried to change to use Rails.cache https://github.com/saiqulhaq/datagrid/blob/2c767bba4533d8f855a2edc1b19fde5c6fb96cc5/lib/datagrid/columns.rb#L505
but still I can find there is 'set' method being called when I refresh the page, it should be 'get' at all