帶緩存的PHP路由庫:Ham
Ham 是一款輕量級的路由框架,利用緩存來提升速度。把任何 I/O 相關的東西緩存進 XCache/APC。要求 PHP 5.3+ 和 XCache 或者 APC。
示例代碼:
require '../ham/ham.php'; $app = new Ham('example'); $app->config_from_file('settings.php'); $app->route('/pork', function($app) { return "Delicious pork."; }); $hello = function($app, $name='world') { return $app->render('hello.html', array( 'name' => $name )); }; $app->route('/hello/<string>', $hello); $app->route('/', $hello); $app->run();
目標
- Make pretty much anything I/O related cached with XCache/APC (whichever is installed) in order to prevent excessive disk usage or path searching on lots of requests.
- Provide a succinct syntax that means less magic and less code to read through and learn, without compromising speed or code length, by using native PHP methods and features.
- Promote a simple, flat way of building applications that don't need massive levels of abstraction.
- Encourage use of excellent third-party libraries such as Doctrine to prevent developers writing convoluted, unmaintainable code that people like me have to pick up and spend hours poring over just to get an idea of what on earth is going on.
- Define and document development patterns that allow for new developers to get up to speed quickly and write new code that isn't hacky.
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!