Giter Site home page Giter Site logo

orkestraapcbundle's Introduction

Orkestra APCBundle

An APC Bundle for Symfony 2 PHP Framework

French

Ce bundle contient :

  • Une commande permettant de supprimer le cache utilisateur et/ou OPCode.
  • Un service permettant d'utiliser APC très facilement.
  • Une page de gestion d'APC avec la mémoire utilisée écrit en PHP4 (je ne suis pas l'auteur, voir dossier Extra).

Installation :

  1. Ajouter dans l'AppKernel.php :
// app/AppKernel.php
public function registerBundles()
{
  $bundles = array(
		new Orkestra\APCBundle\OrkestraAPCBundle()
	);
}
  1. Ajouter dans l'autoloader.php :
// app/autoload.php
$loader->registerNamespaces(array(
	'Orkestra' => __DIR__.'/../vendor/bundles',
);
  1. Configurez votre config.yml : Configuration minimale :
# app/config/config.yml
orkestra_apc:
	# URL de votre site. Utilisé par la commande de clear.
    website_url: http://orkestra.dev

Configuration complète :

# app/config/config.yml
orkestra_apc:
	# URL de votre site. Utilisé par la commande de clear.
    website_url: http://orkestra.dev
	# Emplacement du dossier "web". Modifiez cette option seulement si vous avez déplacé le dossier.
	web_dir: %kernel.root_dir%/../web
	# La commande de clear va créer un fichier dans votre dossier web, si jamais la suppression ne fonctionne pas (vous serez averti), un mot de passe est toujours plus sécurisant.
    access_password: my_password
  1. Utilisation de la classe APC :
$apc = $this->container->get('orkestra.apc');
$apc->set('new_value', 'example', 300); // 300 seconds before timeout (auto delete)
if ($apc->exist('new_value')) {
    $apc->get('new_value');
}
$apc->delete('new_value');
  1. Enfin, l'utilisation de la commande :
Usage:
 php app/console apc:clear [--opcode] [--user]
Options:
 --opcode  Supprime seulement le cache OPCode
 --user    Supprime seulement le cache utilisateur
Help:
 Note: si aucune option n'est renseignée, les deux caches seront supprimés

English

This bundle contains :

  • A command to delete the user or/and OPCode cache.
  • A service to user APC very easily.
  • An APC manager page with used memory write in PHP4 (i'm not the author, see Extra folder).

Installation :

  1. Add in AppKernel.php :
// app/AppKernel.php
public function registerBundles()
{
	$bundles = array(
		new Orkestra\APCBundle\OrkestraAPCBundle()
	);
}
  1. Add in autoloader.php :
// app/autoload.php
$loader->registerNamespaces(array(
	'Orkestra' => __DIR__.'/../vendor/bundles',
);
  1. Configure your config.yml : Basic configuration :
# app/config/config.yml
orkestra_apc:
	# Your website URL. Use by the clear command.
    website_url: http://orkestra.dev

Full configuration :

# app/config/config.yml
orkestra_apc:
	# Your website URL. Use by the clear command.
    website_url: http://orkestra.dev
	# Location of the "web" folder. Edit this option only if you have moved this folder.
	web_dir: %kernel.root_dir%/../web
	# The clear command will create a file in your web folder, if the removal doesn't work (you will be warned), a password is safety.
    access_password: my_password
  1. APC class usage :
$apc = $this->container->get('orkestra.apc');
$apc->set('new_value', 'example', 300); // 300 seconds before timeout (auto delete)
if ($apc->exist('new_value')) {
	$apc->get('new_value');
}
$apc->delete('new_value');
  1. Finally, command usage :
Usage:
 php app/console apc:clear [--opcode] [--user]
Options:
 --opcode  Clear only the opcode cache
 --user    Clear only the user cache
Help:
 Note: without options, both caches will be deleted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.