{"id":207,"date":"2017-11-06T08:51:34","date_gmt":"2017-11-06T07:51:34","guid":{"rendered":"https:\/\/numa-bord.com\/miniblog\/?p=207"},"modified":"2018-01-14T09:05:14","modified_gmt":"2018-01-14T08:05:14","slug":"symfony-utilisation-simple-cache","status":"publish","type":"post","link":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/","title":{"rendered":"Symfony : Utilisation du \u00ab\u00a0Simple Cache\u00a0\u00bb"},"content":{"rendered":"<p>Depuis sa version 3.1, Symfony dispose d&rsquo;un <a href=\"https:\/\/symfony.com\/doc\/current\/components\/cache.html\">Cache Component<\/a> permettant comme son nom l&rsquo;indique de g\u00e9rer un syst\u00e8me de cache assez facilement. Depuis la version 3.3 du framework, une version simplifi\u00e9 est disponible.<\/p>\n<p>C&rsquo;est un jeu d&rsquo;enfant de mettre une information en cache, la r\u00e9cup\u00e9rer et la supprimer<\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\"><span class=\"kw2\">use<\/span> Symfony\\Component\\Cache\\Simple\\FilesystemCache<span class=\"sy0\">;<\/span><br \/>\n<span class=\"co2\">#<br \/>\n<\/span><span class=\"re0\">$cache<\/span> <span class=\"sy0\">=<\/span> <span class=\"kw2\">new<\/span> FilesystemCache<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">set<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'mon.information'<\/span><span class=\"sy0\">,<\/span> <span class=\"st_h\">'Je place ce texte en cache'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span> <span class=\"co1\">\/\/mise en cache<\/span><br \/>\n<span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">get<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'mon.information'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span> <span class=\"co1\">\/\/r\u00e9cup\u00e9ration<\/span><br \/>\n<span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">delete<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'mon.information'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span> <span class=\"co1\">\/\/suppression<\/span><\/div><\/div>\n<p>Cela peut \u00eatre utilis\u00e9 par exemple pour stocker des param\u00e8tres de configuration.<br \/>\nAfin de permettre \u00e0 l&rsquo;utilisateur de notre application de modifier ces param\u00e8tres depuis un back-office on les stocke en base de donn\u00e9es. Cependant pour ne pas avoir a faire une requ\u00eate \u00e0 chaque fois que l&rsquo;on doit utiliser un des param\u00e8tre, on les met en cache.<\/p>\n<p>Voici un cas concret d&rsquo;utilisation :<br \/>\n&#8211; Mon utilisateur peut depuis le back-office cr\u00e9er des \u00ab\u00a0Organization\u00a0\u00bb (entit\u00e9), il leur donne un nom et peux cocher 4 diff\u00e9rents bloc d&rsquo;options possible pour cette \u00ab\u00a0organization\u00a0\u00bb.<br \/>\n&#8211; J&rsquo;ai plus tard dans mon application besoin de connaitre la liste des \u00ab\u00a0Organization\u00a0\u00bb ayant telle option.<br \/>\nPour des question d&rsquo;optimisation (moins de requ\u00eates) mais aussi pour des questions pratiques je vais utiliser le syst\u00e8me de cache.<br \/>\nCi dessous le service \u00ab\u00a0CacheManager\u00a0\u00bb que je vais utiliser : <\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\"><span class=\"kw2\">namespace<\/span> AppBundle\\Service<span class=\"sy0\">;<\/span><br \/>\n<br \/>\n<span class=\"kw2\">use<\/span> Doctrine\\ORM\\EntityManagerInterface<span class=\"sy0\">;<\/span><br \/>\n<span class=\"kw2\">use<\/span> Symfony\\Component\\Cache\\Simple\\FilesystemCache<span class=\"sy0\">;<\/span><br \/>\n<span class=\"kw2\">use<\/span> AppBundle\\Entity\\Organization<span class=\"sy0\">;<\/span><br \/>\n<br \/>\n<span class=\"kw2\">class<\/span> CacheManager <span class=\"br0\">&#123;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw2\">private<\/span> <span class=\"re0\">$em<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw2\">public<\/span> <span class=\"kw2\">function<\/span> __construct<span class=\"br0\">&#40;<\/span>EntityManagerInterface <span class=\"re0\">$em<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$this<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">em<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$em<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"co4\">\/**<br \/>\n&nbsp; &nbsp; &nbsp;* Met \u00e0 jour les informations en cache.<br \/>\n&nbsp; &nbsp; &nbsp;* Stocke un tableau contenant les identifiants des &quot;organization&quot; ouvertes aux diff\u00e9rentes options<br \/>\n&nbsp; &nbsp; &nbsp;*\/<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw2\">public<\/span> <span class=\"kw2\">function<\/span> updateOrganizationOptions<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$cache<\/span> <span class=\"sy0\">=<\/span> <span class=\"kw2\">new<\/span> FilesystemCache<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$entities<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$this<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">em<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getRepository<\/span><span class=\"br0\">&#40;<\/span>Organization<span class=\"sy0\">::<\/span><span class=\"kw2\">class<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">findAll<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option1<\/span> <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option2<\/span> <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option3<\/span> <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option4<\/span> <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">foreach<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$entities<\/span> <span class=\"kw1\">as<\/span> <span class=\"re0\">$entity<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getOptions1<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option1<\/span><span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getId<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getOptions2<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option2<\/span><span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getId<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getOptions3<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option3<\/span><span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getId<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span><span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getOptions4<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$option4<\/span><span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$entity<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">getId<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">set<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'organization.ids.options1'<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$option1<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">set<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'organization.ids.options2'<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$option2<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">set<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'organization.ids.options3'<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$option3<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">set<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'organization.ids.options4'<\/span><span class=\"sy0\">,<\/span> <span class=\"re0\">$option4<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw2\">public<\/span> static <span class=\"kw2\">function<\/span> getOrganizationOptions<span class=\"br0\">&#40;<\/span><span class=\"re0\">$num<\/span> <span class=\"sy0\">=<\/span> <span class=\"nu0\">1<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$cache<\/span> <span class=\"sy0\">=<\/span> <span class=\"kw2\">new<\/span> FilesystemCache<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"re0\">$options<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$cache<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">get<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'organization.ids.options'<\/span> <span class=\"sy0\">.<\/span> <span class=\"re0\">$num<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">return<\/span> <span class=\"re0\">$options<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n<span class=\"br0\">&#125;<\/span><\/div><\/div>\n<p>J&rsquo;utilise ce service pour mettre \u00e0 jour le cache des options \u00e0 la cr\u00e9ation ou la modification d&rsquo;une \u00ab\u00a0organization\u00a0\u00bb.<br \/>\nDans les controllers correspondants c&rsquo;est fait de la fa\u00e7on suivante :<\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\"><span class=\"co1\">\/\/traitement classique (si le formulaire post\u00e9 par l\u2019utilisateur est valide, j'enregistre les donn\u00e9es)<\/span><br \/>\n<span class=\"co1\">\/\/+<\/span><br \/>\n<span class=\"re0\">$CM<\/span> <span class=\"sy0\">=<\/span> <span class=\"re0\">$this<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">get<\/span><span class=\"br0\">&#40;<\/span><span class=\"st_h\">'app.cache.manager'<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><span class=\"co1\">\/\/appel du service<\/span><br \/>\n<span class=\"re0\">$CM<\/span><span class=\"sy0\">-&gt;<\/span><span class=\"me1\">updateOrganizationOptions<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><span class=\"co1\">\/\/mise \u00e0 jour du cache<\/span><\/div><\/div>\n<p>N&rsquo;oubliez pas que si les donn\u00e9es peuvent \u00eatre modifi\u00e9es depuis plusieurs endroits, vous pouvez utiliser les <a href=\"https:\/\/numa-bord.com\/miniblog\/symfony-automatiser-actions-event-listeners-de-doctrine\/\">Event listeners de doctrine<\/a> pour automatiser le traitement et \u00eatre sur d&rsquo;avoir toujours les informations \u00e0 jour.<\/p>\n<p>Je peux maintenant r\u00e9cup\u00e9rer ma liste d&rsquo;organisations ouverte \u00e0 telle option n&rsquo;importe ou gr\u00e2ce \u00e0 ma m\u00e9thode statique :<\/p>\n<div class=\"codecolorer-container php default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"php codecolorer\">CacheManager<span class=\"sy0\">::<\/span><span class=\"me2\">getOrganizationOptions<\/span><span class=\"br0\">&#40;<\/span><span class=\"nu0\">1<\/span><span class=\"br0\">&#41;<\/span><\/div><\/div>\n<p>Dans la r\u00e9alit\u00e9 il s\u2019agissait pour moi de proposer les diff\u00e9rents champs correspondants au options dans un formulaire. Formulaire dans lequel on choisissait une organisation dans une liste d\u00e9roulante, en fonction du choix certaines options apparaissaient donc. Idem pour le contr\u00f4le lors de la soumission du formulaire afin de valider l&rsquo;entit\u00e9 sans passer dans l&rsquo;organization li\u00e9e.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Depuis sa version 3.1, Symfony dispose d&rsquo;un Cache Component permettant comme son nom l&rsquo;indique de g\u00e9rer un syst\u00e8me de cache assez facilement. Depuis la version 3.3 du framework, une version simplifi\u00e9 est disponible. C&rsquo;est un jeu d&rsquo;enfant de mettre une information en cache, la r\u00e9cup\u00e9rer et la supprimer use Symfony\\Component\\Cache\\Simple\\FilesystemCache; # $cache = new FilesystemCache&#40;&#41;; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-developpement","category-symfony"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Symfony : Utilisation du &quot;Simple Cache&quot; - Pense b\u00eate d&#039;un d\u00e9veloppeur web<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Symfony : Utilisation du &quot;Simple Cache&quot; - Pense b\u00eate d&#039;un d\u00e9veloppeur web\" \/>\n<meta property=\"og:description\" content=\"Depuis sa version 3.1, Symfony dispose d&rsquo;un Cache Component permettant comme son nom l&rsquo;indique de g\u00e9rer un syst\u00e8me de cache assez facilement. Depuis la version 3.3 du framework, une version simplifi\u00e9 est disponible. C&rsquo;est un jeu d&rsquo;enfant de mettre une information en cache, la r\u00e9cup\u00e9rer et la supprimer use SymfonyComponentCacheSimpleFilesystemCache; # $cache = new FilesystemCache&#040;&#041;; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\" \/>\n<meta property=\"og:site_name\" content=\"Pense b\u00eate d&#039;un d\u00e9veloppeur web\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-06T07:51:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-14T08:05:14+00:00\" \/>\n<meta name=\"author\" content=\"Numa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Numa\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\"},\"author\":{\"name\":\"Numa\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e\"},\"headline\":\"Symfony : Utilisation du \u00ab\u00a0Simple Cache\u00a0\u00bb\",\"datePublished\":\"2017-11-06T07:51:34+00:00\",\"dateModified\":\"2018-01-14T08:05:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\"},\"wordCount\":579,\"commentCount\":0,\"articleSection\":[\"D\u00e9veloppement\",\"Symfony\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\",\"url\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\",\"name\":\"Symfony : Utilisation du \\\"Simple Cache\\\" - Pense b\u00eate d&#039;un d\u00e9veloppeur web\",\"isPartOf\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#website\"},\"datePublished\":\"2017-11-06T07:51:34+00:00\",\"dateModified\":\"2018-01-14T08:05:14+00:00\",\"author\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e\"},\"breadcrumb\":{\"@id\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/numa-bord.com\/miniblog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Symfony : Utilisation du \u00ab\u00a0Simple Cache\u00a0\u00bb\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#website\",\"url\":\"https:\/\/numa-bord.com\/miniblog\/\",\"name\":\"Pense b\u00eate d&#039;un d\u00e9veloppeur web\",\"description\":\"(php, javascript, Symfony, Wordpress....)\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/numa-bord.com\/miniblog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e\",\"name\":\"Numa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g\",\"caption\":\"Numa\"},\"url\":\"https:\/\/numa-bord.com\/miniblog\/author\/negonner\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Symfony : Utilisation du \"Simple Cache\" - Pense b\u00eate d&#039;un d\u00e9veloppeur web","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/","og_locale":"fr_FR","og_type":"article","og_title":"Symfony : Utilisation du \"Simple Cache\" - Pense b\u00eate d&#039;un d\u00e9veloppeur web","og_description":"Depuis sa version 3.1, Symfony dispose d&rsquo;un Cache Component permettant comme son nom l&rsquo;indique de g\u00e9rer un syst\u00e8me de cache assez facilement. Depuis la version 3.3 du framework, une version simplifi\u00e9 est disponible. C&rsquo;est un jeu d&rsquo;enfant de mettre une information en cache, la r\u00e9cup\u00e9rer et la supprimer use SymfonyComponentCacheSimpleFilesystemCache; # $cache = new FilesystemCache&#40;&#41;; [&hellip;]","og_url":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/","og_site_name":"Pense b\u00eate d&#039;un d\u00e9veloppeur web","article_published_time":"2017-11-06T07:51:34+00:00","article_modified_time":"2018-01-14T08:05:14+00:00","author":"Numa","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Numa","Dur\u00e9e de lecture estim\u00e9e":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#article","isPartOf":{"@id":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/"},"author":{"name":"Numa","@id":"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e"},"headline":"Symfony : Utilisation du \u00ab\u00a0Simple Cache\u00a0\u00bb","datePublished":"2017-11-06T07:51:34+00:00","dateModified":"2018-01-14T08:05:14+00:00","mainEntityOfPage":{"@id":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/"},"wordCount":579,"commentCount":0,"articleSection":["D\u00e9veloppement","Symfony"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/","url":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/","name":"Symfony : Utilisation du \"Simple Cache\" - Pense b\u00eate d&#039;un d\u00e9veloppeur web","isPartOf":{"@id":"https:\/\/numa-bord.com\/miniblog\/#website"},"datePublished":"2017-11-06T07:51:34+00:00","dateModified":"2018-01-14T08:05:14+00:00","author":{"@id":"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e"},"breadcrumb":{"@id":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/numa-bord.com\/miniblog\/symfony-utilisation-simple-cache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/numa-bord.com\/miniblog\/"},{"@type":"ListItem","position":2,"name":"Symfony : Utilisation du \u00ab\u00a0Simple Cache\u00a0\u00bb"}]},{"@type":"WebSite","@id":"https:\/\/numa-bord.com\/miniblog\/#website","url":"https:\/\/numa-bord.com\/miniblog\/","name":"Pense b\u00eate d&#039;un d\u00e9veloppeur web","description":"(php, javascript, Symfony, Wordpress....)","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/numa-bord.com\/miniblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Person","@id":"https:\/\/numa-bord.com\/miniblog\/#\/schema\/person\/f9d00acd1703f17e5a6895283eb46a7e","name":"Numa","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f21d1af4658a7106211915940584534c1e0b3eef3f12eb67a697686cad70b64a?s=96&d=mm&r=g","caption":"Numa"},"url":"https:\/\/numa-bord.com\/miniblog\/author\/negonner\/"}]}},"_links":{"self":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":12,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":234,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/posts\/207\/revisions\/234"}],"wp:attachment":[{"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/numa-bord.com\/miniblog\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}