Sha256: 2c8df05e208d43ccf424e8b0e4a534bfa031f7be3b8668bdabda7bdf40156644

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 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

## Tests

To run the test suite just execute:

    $ bundle exec rspec spec/

No setup neccessary.

## 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

5 entries across 5 versions & 1 rubygems

Version Path
infopark_component_cache-4.0.1 README.md
infopark_component_cache-4.0.0 README.md
infopark_component_cache-3.2.0 README.md
infopark_component_cache-3.1.1 README.md
infopark_component_cache-3.1.0 README.md