PHP有不少Redis库,比如pecl的Redis库(phpredis),就是直接自带了数组的存取和读出,因为他在存储和读出的时候自动序列化了。象是象predis就不行,如果你直接存一个数组去,那么它就会报warning,同时存一个Array到指定的KEY上。
但是predis允许你封装自定义的redis方法。比如jsonset/jsonget,这时候你利用这些自定义的方法来获取或写入数组即可。(基于Laravel,其他的也一样,其他参考:Setting arrays · Issue #136 · predis/predis (github.com))
只是官方的Issue中 【Predis\Profile\ServerProfile:】已经不存在了,要换成【Predis\Profile\Factory】,其余可以复制
----
基于Laravel的话,上述的数组可以放到config里,就啥出不用配置了~~
PHP代码
- if (!function_exists('yredis')) {
- class StringSetJson extends Predis\Command\StringSet
- {
- protected function filterArguments(array $arguments)
- {
- $arguments[1] = json_encode($arguments[1]);
- return $arguments;
- }
- }
-
- class StringGetJson extends Predis\Command\StringGet
- {
- public function parseResponse($data)
- {
- return json_decode($data, true);
- }
- }
-
- class StringSetPhp extends Predis\Command\StringSet
- {
- protected function filterArguments(array $arguments)
- {
- $arguments[1] = serialize($arguments[1]);
- return $arguments;
- }
- }
-
- class StringGetPhp extends Predis\Command\StringGet
- {
- public function parseResponse($data)
- {
- return unserialize($data);
- }
- }
-
-
-
-
-
-
- function yredis()
- {
- try {
- $redis = app('yredis');
- } catch (Exception $e) {
- app()->singleton('yredis', function ($app) {
- $config = $app->make('config')->get('database.redis', []);
- unset($config['options']['prefix']);
- if(env('REDIS_CLIENT') == 'predis'){
- $config['options']['profile'] = function ($options, $option) {
- $profile = \Predis\Profile\Factory::getDefault();
- $profile->defineCommand('jsonset', 'StringSetJson');
- $profile->defineCommand('jsonget', 'StringGetJson');
- $profile->defineCommand('phpset', 'StringSetPhp');
- $profile->defineCommand('phpget', 'StringGetPhp');
- return $profile;
- };
- }
- return new \Illuminate\Redis\RedisManager($app, \Illuminate\Support\Arr::pull($config, 'client', 'phpredis'), $config);
- });
- app()->bind('yredis.connection', function ($app) {
- return $app['yredis']->connection();
- });
- $redis = app('yredis');
- }
- return $redis;
- }
- }
因为laravel的默认config会带 prefix,所以写一个简单的,其实就是为了在写数据的时候不加 prefix 。。。
着实意外,域名突然过期了,在续费的时候又遇上了订单卡住。然后解析在某一瞬间突然就被干掉。
经过和供应商的沟通,2天后恢复了。也就是4-19日已经恢复。真让人纠结啊~
下次记得得一续2年
# whois.verisign-grs.com
Domain Name: NEATSTUDIO.COM
Registry Domain ID: 116852913_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.bizcn.com
Registrar URL: http://www.bizcn.com
Updated Date: 2022-04-19T06:12:59Z
Creation Date: 2004-04-12T07:05:54Z
Registry Expiry Date: 2023-04-12T07:05:54Z
Registrar: Bizcn.com, Inc.
Registrar IANA ID: 471
Registrar Abuse Contact Email:
Registrar Abuse Contact Phone:
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: F1G1NS1.DNSPOD.NET
Name Server: F1G1NS2.DNSPOD.NET
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
前前后后,居然过期了7天。。
由于我系统中的php是通过brew install 进行安装的。因此当遇到imap要使用的时候发现没法安装,因为我直接brew install php@7.4-imap无效。
网上找了点资料,发现还是得使用新的命令
1、brew tap shivammathur/php (这句应该是已经有了,因为php@7.4就是通过这个资源进行安装的)
2、brew tap shivammathur/extensions ,
3、brew install imap@7.4
然后系统会下载和更新库,主要是用了imap-uw和openssl扩展。一堆download和install后,运行 php -m|grep imap,发现已经OK了
作为一个外包,几乎要会所有的东西(肯定不可能精通),比如APP,之前APP简单的话就是APP套个壳,然后里面用webview。后面用UNIAPP,毕竟uniapp也能够做到自更新(self-update,即下载wgt,重启后就更新了)
如果抛开性能,这两种方式其实也都OK,但自从上次做了个100多M的APP,页面数超过100多后,在IPAD上还是偶尔会出现白屏情况,就是内存耗光,最后是通过不停的优化,以后适时的relaunch来解决这个问题。但还是偶尔会出现白屏(次数少了很多)
因此flutter就成了首选对象了,毕竟也是跨平台,而且还能写macOS和windows的程序。。。
正因为访问速度慢,所以就得不停的找镜像源,比如https://pub.flutter-io.cn/,这个就是大家常用的了。看了一下,其实还是有不少的第三方源,比如交大、中科大之类的。
Flutter 社区
社区主镜像,采用多种方式同步 Flutter 开发者资源(推荐)。
$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
上海交大 Linux 用户组
使用反向代理方式建立的 Flutter 镜像,数据与站源实时同步。 Pub API 返回值未做处理,可能造成无法访问的情况。
$ export PUB_HOSTED_URL=https://dart-pub.mirrors.sjtug.sjtu.edu.cn
$ export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn
清华大学 TUNA 协会
定时与 Flutter 社区 Storage 镜像同步,Pub API 采取定时主动抓取策略,镜像配置了完善的失败回源策略(推荐)。
$ export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub
$ export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter
CNNIC
基于 TUNA 协会的镜像服务,数据策略与 TUNA 一致,通过非教育网的域名访问。
$ export PUB_HOSTED_URL=http://mirrors.cnnic.cn/dart-pub
$ export FLUTTER_STORAGE_BASE_URL=http://mirrors.cnnic.cn/flutter
腾讯云开源镜像站
定时(每天凌晨)与 TUNA 协会镜像同步,数据有延迟,访问速度有待反馈。
$ export PUB_HOSTED_URL=https://mirrors.cloud.tencent.com/dart-pub
$ export FLUTTER_STORAGE_BASE_URL=https://mirrors.cloud.tencent.com/flutter
---EOF
本来是想用交大的,因为我访问交大源都低于10ms,其他的都是在20~30之间。但上面写了 【 Pub API 返回值未做处理,可能造成无法访问的情况】,好尴尬。先用腾讯的吧,这是第二快的源。
网上很多教程都在教你怎么录屏,但没有说怎么停止。。。实话实说,为了停止它,真的查了不少资料。
现在说两个方法
1、录屏后,点击cmd+control+esc,会退出录屏
2、状态栏顶部有个小图标,点击可以直接退出
还有就是强制退出,然后到:~/Library/Containers/com.apple.QuickTimePlayerX/Data/Library/Autosave Information/,可以看一下是不是有刚才录的视频。