1 2 3 4 5 ··· 9 下一页

2020年8月6日

数组转对象、对象转数组

摘要: <?php namespace App\Utils { class BeanUtils { const TYPE_INT = 'int'; const TYPE_STRING = 'string'; const TYPE_FLOAT = 'float'; const TYPE_DEFAULT = ' 阅读全文

posted @ 2020-08-06 12:12 周~~ 阅读(346) 评论(0) 推荐(0) 编辑

2019年11月5日

lumen-framework 5.2 - redis 杂文

摘要: public static function lock($key, $value, $expireSeconds) { $response = Redis::set($key, $value, 'ex', $expireSeconds, 'nx'); if($response=='OK'){ return true; } return false; } public static function 阅读全文

posted @ 2019-11-05 19:44 周~~ 阅读(217) 评论(0) 推荐(0) 编辑

2019年4月17日

Laravel5.5源代码 - 并发数控制

摘要: app('redis')->connection('default')->funnel('key000') // 每个资源最大锁定10秒自动过期,只有60个资源(并发),在3秒内获取不到锁抛出异常 ->releaseAfter(10)->limit(60)->block(3) ->then(func 阅读全文

posted @ 2019-04-17 16:21 周~~ 阅读(240) 评论(0) 推荐(0) 编辑

Laravel5.5源代码 - 限流工具

摘要: app('redis')->connection('default')->throttle('key000') // 每60秒,只能有10个资源被获取,在3秒内获取不到锁抛出异常 ->allow(10)->every(60)->block(3) ->then(function () { // 获取锁 阅读全文

posted @ 2019-04-17 16:20 周~~ 阅读(141) 评论(0) 推荐(0) 编辑

2019年2月13日

Yii 2.0.6 - 从入口到Action执行

摘要: defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require(__DIR__ . '/../vendor/autoload.php'); // 注册 Composer 加载器 Yii::setAlias('@common', di... 阅读全文

posted @ 2019-02-13 11:44 周~~ 阅读(506) 评论(0) 推荐(0) 编辑

2019年1月25日

Lavavel5.5源代码 - RedisQueue是怎么实现

摘要: 队列的基本功能: 1、立即执行;yes 2、延迟执行;yes 3、保证至少执行一次;yes 4、必须执行且最多执行一次;no 用到的数据结构: list、Sorted sets 延迟执行的机制: 1、先把数据放入SortedSets类型的queues:queue_000:delayed中 2、在执行 阅读全文

posted @ 2019-01-25 23:01 周~~ 阅读(201) 评论(0) 推荐(0) 编辑

2018年12月29日

Lavavel5.5源代码 - Pipeline

摘要: passable = $passable; return $this; } public function through($pipes) { $this->pipes = is_array($pipes) ? $pipes : func_get_args(); return $this; } pub... 阅读全文

posted @ 2018-12-29 18:20 周~~ 阅读(219) 评论(0) 推荐(0) 编辑

2018年3月23日

php-5.6.26源代码 - hash存储结构 - 添加

摘要: 添加 if (zend_hash_add(&module_registry, lcname, name_len+1, (void *)module, sizeof(zend_module_entry), (void**)&module_ptr){ // zend_hash_add 定义在文件“php-5.6.26\Zend\zend_hash.h” #... 阅读全文

posted @ 2018-03-23 18:10 周~~ 阅读(216) 评论(0) 推荐(0) 编辑

php-5.6.26源代码 - hash存储结构 - 初始化

摘要: 初始化 有指定析构函数,在销毁hash的时候会调用,如:“类似extension=test.so扩展”也是存放在HashTable中的,“类似extension=test.so扩展”的module_shutdown_func函数就是靠hash的析构函数来调用的 zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUN... 阅读全文

posted @ 2018-03-23 18:09 周~~ 阅读(128) 评论(0) 推荐(0) 编辑

php-5.6.26源代码 - hash存储结构 - hash算法

摘要: // zend_inline_hash_func 实现在文件“php-5.6.26\Zend\zend_hash.h” h = zend_inline_hash_func(arKey, nKeyLength); { // zend_hash_add 定义在文件“php-5.6.26\Zend\zend_hash.h” /* ... 阅读全文

posted @ 2018-03-23 18:06 周~~ 阅读(202) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 9 下一页

导航