chatbox/tmp-data
Composer 安装命令:
composer create-project chatbox/tmp-data
包简介
temp data provider
README 文档
README
一時的なKVS形式のデータを取り扱う際のユーティリティ
Usage
$tmpData = new \TmpData\TempDataProvider([
"tableName" => "tmp_token",
"dns" => "mysql://hogehoge"
]);
$tmpData->set($key,$value); // write data
$token = $tmpData->pickUp($key); //read data and update timestamp
$token = $tmpData->read($key); //just read data
//token will be null or \Chatbox\TempData Object
if($token->isUsable()){ // check if token in term
$key = $token->key;
$value = $token->value;
$createdAt = $token->createdAt;
$updatedAt = $token->updatedAt;
$expiredAt = $token->expiredAt;
$accessedAt = $token->accessedAt;
$deletedAt = $token->deletedAt;
}
$token->update($value); // update data
$token->delete(); // soft delete
$tmpData->flush(); // delete all data
schema
key string value string createdAt timestamp updatedAt timestamp accessedAt timestamp expiredAt timestamp deletedAt timestamp
Simply you can use \Chatbox\TmpData\SchemaBuilder to generate Builder Closure
# in laravel4
Schema::create('tmp_token', new \Chatbox\TmpData\SchemaBuilder());
Schema::create('tmp_confirm_mail', new \Chatbox\TmpData\SchemaBuilder([
"useAccessedAt" => false,
"defaultExpiredAt" => "200000",
]));
[
"cb_room" => function(Blueprint $table){
$table->unsignedInteger("id",true);
$table->string("srug");
$table->unsignedInteger("tenants");
$table->text("prop");
$table->dateTime("created_at");
$table->dateTime("updated_at");
},
"cb_room_tag" => function(Blueprint $table){
$table->unsignedInteger("id",true);
$table->unsignedInteger("room_id");
$table->string("type");
$table->string("value");
$table->dateTime("created_at");
$table->dateTime("updated_at");
},
"cb_user" => function(Blueprint $table){
$table->unsignedInteger("id",true);
$table->string("name");
$table->string("enter_key");
$table->text("prop");
$table->dateTime("created_at");
$table->dateTime("updated_at");
},
"cb_user_tag" => function(Blueprint $table){
$table->unsignedInteger("id",true);
$table->unsignedInteger("user_id");
$table->string("type");
$table->string("value");
$table->dateTime("created_at");
$table->dateTime("updated_at");
},
"cb_tenants" => function(Blueprint $table){
$table->unsignedInteger("id",true);
$table->unsignedInteger("room_id");
$table->unsignedInteger("user_id");
$table->boolean("is_kicked");
$table->dateTime("created_at");
$table->dateTime("updated_at");
},
"cb_message" => function(Blueprint $table){
$table->unsignedInteger("id",true);
$table->unsignedInteger("room_id");
$table->unsignedInteger("user_id");
$table->string("type");
$table->text("message");
$table->dateTime("created_at");
$table->dateTime("updated_at");
},
],
"seeds" => [
["master_user",function(Builder $builder){
$builder->insert([
"name"=>"Tom",
"sex" => "1"
]);
}],
],
"include" => [
"user" => __DIR__."/data/user.php"
]
];
chatbox/tmp-data 适用场景与选型建议
chatbox/tmp-data 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 01 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 chatbox/tmp-data 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chatbox/tmp-data 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-20