pader/weak-array
最新稳定版本:1.0.1
Composer 安装命令:
composer require pader/weak-array
包简介
Array weak reference with value.
README 文档
README
An ArrayAccess implement let you can storage a weak reference object in array by any key type.
This like an temporary cache, help you to reuse same object when it's still use in other place, and will auto unset the item when all reference is destruct.
Install
Require php version >= 8.0.0
composer require pader/weak-array
Simple example:
$hello = new stdClass; $hello->value = 'hello'; $world = new stdClass; $world->value = 'world'; $arr = new WeakArray(); $arr[] = $hello; $arr['foo'] = $world; var_dump($arr[0]); var_dump($arr['foo']); unset($hello); var_dump($arr[0]); //Should be null var_dump($arr['foo']);
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-07