定制 chatbox/tmp-data 二次开发

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

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

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" ] ];

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固