承接 cs/symfony-vagrant-kernel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cs/symfony-vagrant-kernel

Composer 安装命令:

composer require cs/symfony-vagrant-kernel

包简介

Speeds up Symfony when host source dir is shared over network with Vagrant box.

README 文档

README

This package can speed up your Symfony dev installation when you're using Vagrant.

If your application is residing on your host os' drive and it's shared with Vagrant box over network then symfony cache and logs IO will kill your performance. This kernel extension configures your application to store cache and logs in /dev/shm.

The only drawback I can think of is that the whole cache (possible including sessions) will be lost once you power down the Vagrant box. Oh, and /dev/shm was probably designed for sharing...

WARNING! This is not for production. Use at your own risk! WARNING! The logs will be in /dev/shm/(symfony2|projectname)/logs.

Installation

Add "cs/symfony-vagrant-kernel": "1.0", to your composer.json.

Change the line use Symfony\Component\HttpKernel\Kernel; to use CS\Vagrant\Kernel; in your app/AppKernel.php.

Multiple projects on the same Vagrant box

If you have multiple projects running on the same vagrant box then you should define your "project name" which is basically the name of /dev/shm subdirectory which will be used to store your cache. If you don't do this then prepare for chaos to ensue.

Override the method getProjectName, so it looks sth like this:

protected function getProjectName()
{
    return 'some_unique_string_preferably_the_name_of_your_project';
}

Configure when to attempt to use the memory cache.

By default the kernel will enable /dev/shm caching when following conditions are met:

  • You have a writable /dev/shm directory.
  • /home/vagrant exists in your filesystem.

You can change the last condition by overriding the method useMemoryCaching in your kernel. For example if you want this feature to be used always in your dev environment do sth like this:

protected function useMemoryCaching()
{
    return $this->getEnvironment() === 'dev';
}

Other considerations

I suppose you could use /tmp but doesn't memory cache sound better?

Acknowledgment

This code is based on the idea presented by Benjamin Eberlei and later expanded by Jakub Kanclerz.

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固