定制 phpnomad/symfony-cache-integration 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

phpnomad/symfony-cache-integration

最新稳定版本:1.0.0

Composer 安装命令:

composer require phpnomad/symfony-cache-integration

包简介

README 文档

README

Latest Version Total Downloads PHP Version License

phpnomad/symfony-cache-integration adapts Symfony's Cache component to phpnomad/cache's CacheStrategy contract. It ships a single strategy, SymfonyFileCache, backed by Symfony's FilesystemAdapter. Your application code still depends only on the CacheStrategy interface, so the Symfony-specific wiring stays at the bootstrap layer and never leaks into the services that read and write cached values.

Installation

composer require phpnomad/symfony-cache-integration

What This Provides

  • SymfonyFileCache, a CacheStrategy implementation backed by Symfony's FilesystemAdapter. It gives you a filesystem-backed persistent cache that satisfies the phpnomad/cache contract (get, set, delete, exists, clear) and throws CachedItemNotFoundException on a miss, so consumers can catch the exception and fall back to their source of truth.

Requirements

  • phpnomad/cache for the CacheStrategy interface and the CachedItemNotFoundException this package throws
  • symfony/cache ^7.1, the Symfony Cache component this package wraps
  • PHP 8.2 or newer, inherited from symfony/cache ^7.1

Usage

Register SymfonyFileCache as the concrete implementation of CacheStrategy in one of your application's initializers. The container then resolves any service that type-hints CacheStrategy to the filesystem-backed adapter.

<?php

namespace MyApp\Bootstrap;

use PHPNomad\Cache\Interfaces\CacheStrategy;
use PHPNomad\Loader\Interfaces\HasClassDefinitions;
use PHPNomad\Symfony\Component\CacheIntegration\Strategies\SymfonyFileCache;

final class AppInitializer implements HasClassDefinitions
{
    public function getClassDefinitions(): array
    {
        return [
            SymfonyFileCache::class => CacheStrategy::class,
        ];
    }
}

Pass AppInitializer to your Bootstrapper alongside the rest of your initializers and the binding takes effect when load() runs.

Documentation

Full PHPNomad documentation lives at phpnomad.com. For the underlying caching layer, see the Symfony Cache component documentation.

License

Licensed under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固