Sha256: 46db528765646c882ca513627e0b5619ab13ef5a3029aaef008d195b9d1b6013

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

# Infopark's ComponentCache

Fragment caching with automatic dependency resolution and cache invalidation.

## Installation

Add this line to your application's Gemfile:

    gem 'infopark_component_cache'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install infopark_component_cache

## Usage

Set up Rails catching (see [http://guides.rubyonrails.org/caching_with_rails.html](http://guides.rubyonrails.org/caching_with_rails.html)) and
in your view write:
    
    <%= cache_tagged_component(@rails_connector_obj, 'any-string-as-component-name', {:additional => :parameters}) do %>
      This content will be cached
    <% end %>

and you are done.

Alternatively you could use component cache directly:

    <%= InfoparkComponentCache::ComponentCache.new(@rails_connector_obj, 'any-string-as-component-name', {:additional => :parameters}).fetch do %>
      This content will be cached
    <% end %>

Most guard also provide an option to limit the lookup to specific object classes, for example:

    <%= cache_tagged_component(@gallery, 'gallery', {}, [{guard: InfoparkComponentCache::ObjCount, obj_classes: ['Image']}]) do %>
      This content will be cached
    <% end %>

will only get invalidated when the number of objects of the class 'Image' changes in the CMS.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
infopark_component_cache-3.0.0 README.md
infopark_component_cache-2.0.0 README.md