net_bazzline/php_component_database_file_storage 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

net_bazzline/php_component_database_file_storage

Composer 安装命令:

composer require net_bazzline/php_component_database_file_storage

包简介

local file database

README 文档

README

crud storage interface

/**
 * @param $data
 * @return mixed - unique identifier
 */
public function create($data);

/**
 * @return array
 */
public function readMany();

/**
 * @return null|mixed - nothing or data
 */
public function readOne();

/**
 * @param mixed $data
 * @return boolean
 */
public function update($data);

/**
 * @return boolean
 */
public function delete();

/**
 * @param mixed $key
 * @param mixed $value
 * @return $this
 */
public function filterBy($key, $value);

/**
 * @param mixed $id
 * @return $this
 */
public function filterById($id);

/**
 * @param int $count
 * @param null|int $offset
 * @return $this
 */
public function limitBy($count, $offset = null);

Install

By Hand

mkdir -p vendor/net_bazzline/php_component_database_file_storage
cd vendor/net_bazzline/php_component_database_file_storage
git clone https://github.com/bazzline/php_component_database_file_storage .

With Packagist

composer require net_bazzline/php_component_database_file_storage:dev-master

Benefits

  • implemented locking to prevent multiple reads and writes

API

API is available at bazzline.net.

Future Improvements

  • extend "filterBy"
    • $key and $value are optional to filter by key or by value
  • take a look to bigdump
  • take a look to reactphp/filesystem
  • take a look to file wrapper
  • implement "modifier" to easy up modifiying data before reading or writing
  • if write (create/read) action is triggered, create a *.lock file to prevent multiple writings
  • implement caching via proxy
    • simple two files storages injected
    • if number of changed itemes reaches limit, cache is written into real storage
  • use a uuid generator for unique keys
    • use a temporary file
    • beeing even more pro, use php://temp
      • implement some kind of "intelligent" cache that counts the average size of an entry to determine the maximum number of entries before flushing the cache

History

  • upcomming
    • @todo
    • added support for php version above 7.0
    • dropped support for php version below 5.6
  • 0.7.1 - released at 11.08.2016
    • updated phpunit
  • 0.7.0 - released at 29.03.2016
    • added API section
    • bumped php version to 5.4
    • moved to psr-4 autoloading
    • updated dependencies
  • 0.6.5 - released at 18.12.2015
    • updated dependencies
  • 0.6.4 - released at 11.12.2015
    • updated dependencies
  • 0.6.3 - released at 18.11.2015
    • updated dependencies
  • 0.6.2 - released at 13.09.2015
    • stabalized dependencies
  • 0.6.1 - released at 12.09.2015
    • added protected getIdGenerator, getLockableWriterFactory, getReaderFactory and getStorage methods to easy up creating your own storage by using the default factory
  • 0.6.0 - released at 12.09.2015
    • fixed issue in readMany if limit is used
  • 0.5.0 - released at 12.09.2015
    • added example has
    • added method has($atLeast = 1, $atMost = null)
    • added optional argument resetRuntimeProperties (filters and limit settings) to create, readMany, readOne, update and delete
  • 0.4.1 - released at 11.09.2015
    • adapted to new Experiment from toolbox
  • 0.4.0 - released at 11.09.2015
    • moved code into directories (Storage and IdGenerator)
    • renamed Repository to Storage
  • 0.3.4 - released at 10.09.2015
    • fixed issue in LockableWriterForPhp5Dot3
  • 0.3.3 - released at 10.09.2015
    • fixed issue in LockableWriterForPhp5Dot3
  • 0.3.2 - released at 10.09.2015
    • fixed issue when dealing with php 5.3
  • 0.3.1 - released at 10.09.2015
    • fixed broken unit test
  • 0.3.0 - released at 10.09.2015
    • created and used own LockableWriter to switch from "FileNameLock" to "FileHandlerLock"

Final Words

Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if use it. Make a donation if you love it :-].

net_bazzline/php_component_database_file_storage 适用场景与选型建议

net_bazzline/php_component_database_file_storage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 09 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「php」 「file」 「repository」 「uuid」 「psr」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 net_bazzline/php_component_database_file_storage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 net_bazzline/php_component_database_file_storage 我们能提供哪些服务?
定制开发 / 二次开发

基于 net_bazzline/php_component_database_file_storage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-09-08