Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/bigyouth/page-cache-bundle

This bundle provides a simple page caching solution working as a in-app reverse proxy.
https://github.com/bigyouth/page-cache-bundle

bundle cache php redis symfony symfony-bundle

Last synced: 2 months ago
JSON representation

This bundle provides a simple page caching solution working as a in-app reverse proxy.

Lists

README

        

# Big Youth Page Cache Bundle

| Maintainability | Issues | Downloads | Release |
|:----------------------:|:-----------------------:|:-----------------------:|:-----------------------:|
[![Maintainability](https://img.shields.io/codeclimate/maintainability/bigyouth/page-cache-bundle.svg)](https://codeclimate.com/github/bigyouth/page-cache-bundle) | [![Issues](https://img.shields.io/codeclimate/issues/github/bigyouth/page-cache-bundle.svg)](https://codeclimate.com/github/bigyouth/page-cache-bundle) | [![Downloads](https://img.shields.io/packagist/dt/bigyouth/page-cache-bundle.svg?style=flat-square)](https://packagist.org/packages/bigyouth/page-cache-bundle) | [![Release](https://img.shields.io/packagist/v/bigyouth/page-cache-bundle.svg?style=flat-square)](https://packagist.org/packages/bigyouth/page-cache-bundle) |

## What is it ?

This bundle provides a simple page caching solution working as an in-app reverse proxy.

## Requirements
```yml
"php": "^5.3.9|^7.0",
"symfony/cache": "^3.1"
```

## Installation

### Download the bundle

Download composer at https://getcomposer.org/download/

```bash
composer require bigyouth/page-cache-bundle
```

### Register the bundle

Enable the bundle by adding it to the bundles array of the registerBundles method in your project's app/AppKernel.php file :

```php
render('FrontBundle:Page:index.html.twig');

}
}
```

The PageCacheController rewrites the *render* function to manage and render cache data. All of your controller actions that use the *render* function will be cached.

### Cache invalidation

The **BigyouthPageCacheBundle** uses [cache tags](https://symfony.com/blog/new-in-symfony-3-2-tagged-cache) to identify your cache data. The tags are defined by the url scheme of the cached page.

For example, the page behind */products/list/my-product* will be tagged with **products**, **list** and **my-product**.

Therefore you can invalidate a product page by doing the following in your controller :

```php
// ...

$this->get('by.page_cache')->invalidate(["my-product"]);

// ...
```

or if you want to invalidate all product pages :

```php
// ...

$this->get('by.page_cache')->invalidate(["products"]);

// ...
```
## Authors

* **Alexis Smadja** - *Initial work* - [Alxss](https://github.com/Alxss)

See also the list of [contributors](https://github.com/BigYouth/page-cache-bundle/graphs/contributors) who participated in this project.
## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.