Mohammed H
Mohammed H

Reputation: 7048

How to store data in cache in symfony2

I have a configuration-table(id,name,value), containing some configuration variables for my symfony application such as email_expiration_duration. I want to write a service to read these configuration varibales from symfony application.

I want cache the data in app/cache folder. That means I will read the data from database only if the data is not in cache. I will clear the cached data whenever the configuration value changes.

How can I do it in symfony2?

Upvotes: 15

Views: 9211

Answers (1)

cheesemacfly
cheesemacfly

Reputation: 11762

If you want to store this information in a file you manually create in the app/cache folder, you may use the following solution: https://stackoverflow.com/a/13410635/1443490

If you don't want/need to care about what folder is used inside the app/cache folder and your project already uses Doctrine, you can follow this solution: https://stackoverflow.com/a/8900283/1443490

Upvotes: 4

Related Questions