Skip to content

Update cache.rst #7079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion components/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ meaning of some key concepts:
**Adapter**
It implements the actual caching mechanism to store the information in the
filesystem, in a database, etc. The component provides several ready to use
adapters for common caching backends (Redis, APCu, etc.)
adapters for common caching backends (Redis, APCu, Doctrine, Filesystem, PDO)

Basic Usage
-----------
Expand Down Expand Up @@ -70,6 +70,14 @@ Now you can create, retrieve, updated and delete items using this cache pool::

// remove the cache item
$cache->deleteItem('stats.num_products');

Or you can use redis-based cache, instantiate :class:`Symfony\\Component\\Cache\\Adapter\\RedisAdapter`::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to not add this Redis example here. Why? Because in the "Basic usage" part of the components we display a "Hello World" example ... something very simple to give a glimpse of the features of that component. This example should be moved to the other articles that explain each of the cache types available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


use Symfony\Component\Cache\Adapter\RedisAdapter;

$connection = RedisAdapter::createConnection('redis://127.0.0.1:6379/0');
$cache = new RedisAdapter($connection);


Advanced Usage
--------------
Expand Down