koatty_cacheable 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.rollup.config.js CHANGED
@@ -1,60 +1,60 @@
1
- /*
2
- * @Description:
3
- * @Usage:
4
- * @Author: richen
5
- * @Date: 2021-12-17 10:20:44
6
- * @LastEditTime: 2024-11-04 22:04:45
7
- */
8
- import commonjs from '@rollup/plugin-commonjs';
9
- import json from "@rollup/plugin-json";
10
- import resolve from '@rollup/plugin-node-resolve';
11
- import { builtinModules } from 'module';
12
- import del from "rollup-plugin-delete";
13
- import typescript from 'rollup-plugin-typescript2';
14
- // import babel from '@rollup/plugin-babel';
15
- const pkg = require('./package.json');
16
-
17
- export default [
18
- {
19
- input: './src/index.ts',
20
- output: [
21
- {
22
- format: 'cjs',
23
- file: './dist/index.js',
24
- banner: require('./scripts/copyright'),
25
- },
26
- {
27
- format: 'es',
28
- file: './dist/index.mjs',
29
- banner: require('./scripts/copyright'),
30
- },
31
- ],
32
- plugins: [
33
- del({ targets: ["dist/*", "temp/*", "docs/api"] }),
34
- // babel({
35
- // babelHelpers: "runtime",
36
- // configFile: './babel.config.js',
37
- // exclude: 'node_modules/**',
38
- // }),
39
- json(),
40
- resolve({
41
- preferBuiltins: true, // 优先选择内置模块
42
- }),
43
- commonjs(),
44
- typescript({
45
- tsconfigOverride: {
46
- compilerOptions: {
47
- declaration: false,
48
- declarationMap: false,
49
- module: "ESNext"
50
- }
51
- }
52
- })
53
- ],
54
- external: [
55
- ...builtinModules, // 排除 Node.js 内置模块
56
- ...Object.keys(pkg.dependencies || {}), // 排除 package.json 中的外部依赖
57
- ],
58
- },
59
-
1
+ /*
2
+ * @Description:
3
+ * @Usage:
4
+ * @Author: richen
5
+ * @Date: 2021-12-17 10:20:44
6
+ * @LastEditTime: 2024-11-04 22:04:45
7
+ */
8
+ import commonjs from '@rollup/plugin-commonjs';
9
+ import json from "@rollup/plugin-json";
10
+ import resolve from '@rollup/plugin-node-resolve';
11
+ import { builtinModules } from 'module';
12
+ import del from "rollup-plugin-delete";
13
+ import typescript from 'rollup-plugin-typescript2';
14
+ // import babel from '@rollup/plugin-babel';
15
+ const pkg = require('./package.json');
16
+
17
+ export default [
18
+ {
19
+ input: './src/index.ts',
20
+ output: [
21
+ {
22
+ format: 'cjs',
23
+ file: './dist/index.js',
24
+ banner: require('./scripts/copyright'),
25
+ },
26
+ {
27
+ format: 'es',
28
+ file: './dist/index.mjs',
29
+ banner: require('./scripts/copyright'),
30
+ },
31
+ ],
32
+ plugins: [
33
+ del({ targets: ["dist/*", "temp/*", "docs/api"] }),
34
+ // babel({
35
+ // babelHelpers: "runtime",
36
+ // configFile: './babel.config.js',
37
+ // exclude: 'node_modules/**',
38
+ // }),
39
+ json(),
40
+ resolve({
41
+ preferBuiltins: true, // 优先选择内置模块
42
+ }),
43
+ commonjs(),
44
+ typescript({
45
+ tsconfigOverride: {
46
+ compilerOptions: {
47
+ declaration: false,
48
+ declarationMap: false,
49
+ module: "ESNext"
50
+ }
51
+ }
52
+ })
53
+ ],
54
+ external: [
55
+ ...builtinModules, // 排除 Node.js 内置模块
56
+ ...Object.keys(pkg.dependencies || {}), // 排除 package.json 中的外部依赖
57
+ ],
58
+ },
59
+
60
60
  ]
package/CHANGELOG.md CHANGED
@@ -2,42 +2,44 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.6.1](https://github.com/thinkkoa/koatty_cacheable/compare/v1.6.0...v1.6.1) (2025-06-09)
6
+
5
7
  ## [1.6.0](https://github.com/thinkkoa/koatty_cacheable/compare/v1.5.0...v1.6.0) (2024-11-07)
6
8
 
7
- ## [1.5.0](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.3...v1.5.0) (2024-04-01)
8
-
9
-
10
- ### Features
11
-
12
- * delayedDoubleDeletion ([532f735](https://github.com/thinkkoa/koatty_cacheable/commit/532f735818fc66fa144023cd24282efe350833ba))
13
-
14
- ### [1.4.3](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.2...v1.4.3) (2024-01-17)
15
-
16
-
17
- ### Bug Fixes
18
-
19
- * 缓存key拼装 ([5d0b924](https://github.com/thinkkoa/koatty_cacheable/commit/5d0b9248064d353046bd7287d3a3ee5229e88c23))
20
-
21
- ### [1.4.2](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.1...v1.4.2) (2023-12-20)
22
-
23
- ### [1.4.1](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.0...v1.4.1) (2023-08-04)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * default value ([38f2e57](https://github.com/thinkkoa/koatty_cacheable/commit/38f2e57d52d13482907ca9eac6006d1e841bdadd))
29
- * 初始化缓存改为appReady执行 ([7e9b1ab](https://github.com/thinkkoa/koatty_cacheable/commit/7e9b1abe6acdbdf1b6ad34efa053cbaca1e7b6d7))
30
-
31
- ## [1.4.0](https://github.com/thinkkoa/koatty_cacheable/compare/v1.3.8...v1.4.0) (2023-02-18)
32
-
33
-
34
- ### Bug Fixes
35
-
36
- * cache subkey ([408e3c7](https://github.com/thinkkoa/koatty_cacheable/commit/408e3c709a4dfff6e7d224a22d26e58854a805ac))
37
- * 启动时链接 ([e7ec709](https://github.com/thinkkoa/koatty_cacheable/commit/e7ec7094be106e4e48783c9b214b8369e8a18297))
38
- * 支持引入变量做缓存key ([4ce81aa](https://github.com/thinkkoa/koatty_cacheable/commit/4ce81aaaf9610f4a62ddf43e3c4389dd003c2db8))
39
- * 获取单例 ([0759972](https://github.com/thinkkoa/koatty_cacheable/commit/0759972adf7e86312f60f0bf77604bddf06ce0de))
40
-
41
- ### [1.3.8](https://github.com/thinkkoa/koatty_cacheable/compare/v1.3.6...v1.3.8) (2023-01-13)
42
-
43
- ### [1.3.7](https://github.com/thinkkoa/koatty_cacheable/compare/v1.3.6...v1.3.7) (2022-05-27)
9
+ ## [1.5.0](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.3...v1.5.0) (2024-04-01)
10
+
11
+
12
+ ### Features
13
+
14
+ * delayedDoubleDeletion ([532f735](https://github.com/thinkkoa/koatty_cacheable/commit/532f735818fc66fa144023cd24282efe350833ba))
15
+
16
+ ### [1.4.3](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.2...v1.4.3) (2024-01-17)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * 缓存key拼装 ([5d0b924](https://github.com/thinkkoa/koatty_cacheable/commit/5d0b9248064d353046bd7287d3a3ee5229e88c23))
22
+
23
+ ### [1.4.2](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.1...v1.4.2) (2023-12-20)
24
+
25
+ ### [1.4.1](https://github.com/thinkkoa/koatty_cacheable/compare/v1.4.0...v1.4.1) (2023-08-04)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * default value ([38f2e57](https://github.com/thinkkoa/koatty_cacheable/commit/38f2e57d52d13482907ca9eac6006d1e841bdadd))
31
+ * 初始化缓存改为appReady执行 ([7e9b1ab](https://github.com/thinkkoa/koatty_cacheable/commit/7e9b1abe6acdbdf1b6ad34efa053cbaca1e7b6d7))
32
+
33
+ ## [1.4.0](https://github.com/thinkkoa/koatty_cacheable/compare/v1.3.8...v1.4.0) (2023-02-18)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * cache subkey ([408e3c7](https://github.com/thinkkoa/koatty_cacheable/commit/408e3c709a4dfff6e7d224a22d26e58854a805ac))
39
+ * 启动时链接 ([e7ec709](https://github.com/thinkkoa/koatty_cacheable/commit/e7ec7094be106e4e48783c9b214b8369e8a18297))
40
+ * 支持引入变量做缓存key ([4ce81aa](https://github.com/thinkkoa/koatty_cacheable/commit/4ce81aaaf9610f4a62ddf43e3c4389dd003c2db8))
41
+ * 获取单例 ([0759972](https://github.com/thinkkoa/koatty_cacheable/commit/0759972adf7e86312f60f0bf77604bddf06ce0de))
42
+
43
+ ### [1.3.8](https://github.com/thinkkoa/koatty_cacheable/compare/v1.3.6...v1.3.8) (2023-01-13)
44
+
45
+ ### [1.3.7](https://github.com/thinkkoa/koatty_cacheable/compare/v1.3.6...v1.3.7) (2022-05-27)
package/LICENSE CHANGED
@@ -1,29 +1,29 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2020, Koatty
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- 3. Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2020, Koatty
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,57 +1,188 @@
1
- # koatty_cacheable
2
- Cacheable for koatty.
3
-
4
- Koatty框架的 CacheAble, Cacheable, CacheEvict 支持库
5
-
6
-
7
- # Usage
8
-
9
- db.ts in koatty project:
10
-
11
- ```js
12
- export default {
13
- ...
14
-
15
- "CacheStore": {
16
- type: "memory", // redis or memory, memory is default
17
- // key_prefix: "koatty",
18
- // host: '127.0.0.1',
19
- // port: 6379,
20
- // name: "",
21
- // username: "",
22
- // password: "",
23
- // db: 0,
24
- // timeout: 30,
25
- // pool_size: 10,
26
- // conn_timeout: 30
27
- },
28
-
29
- ...
30
- };
31
-
32
- ```
33
-
34
- used in service:
35
-
36
- ```js
37
- import { CacheAble, CacheEvict, GetCacheStore } from "koatty_cacheable";
38
-
39
- export class TestService {
40
-
41
- @CacheAble("testCache") // auto cached
42
- getTest(){
43
- //todo
44
- }
45
-
46
- @CacheEvict("testCache") // auto clear cache
47
- setTest(){
48
- //todo
49
- }
50
-
51
- test(){
52
- const store = GetCacheStore(this.app);
53
- store.set(key, value);
54
- }
55
- }
56
-
57
- ```
1
+ # koatty_cacheable
2
+
3
+ Cacheable for koatty.
4
+
5
+ Koatty框架的 CacheAble, CacheEvict 缓存装饰器支持库,提供方法级别的缓存功能。
6
+
7
+ ## 特性
8
+
9
+ - 🚀 **简单易用**: 通过装饰器轻松添加缓存功能
10
+ - 🔄 **自动缓存**: `@CacheAble` 装饰器自动缓存方法返回值
11
+ - 🗑️ **智能清除**: `@CacheEvict` 装饰器智能清除相关缓存
12
+ - **延迟双删**: 支持延迟双删策略,解决缓存一致性问题
13
+ - 🔧 **多后端支持**: 支持 Memory 和 Redis 缓存后端
14
+ - 🎯 **参数化缓存**: 支持基于方法参数的缓存键生成
15
+ - 🛡️ **类型安全**: 完整的 TypeScript 支持
16
+
17
+ ## 安装
18
+
19
+ ```bash
20
+ npm install koatty_cacheable
21
+ ```
22
+
23
+ ## 配置
24
+
25
+ koatty 项目的 `db.ts` 配置文件中添加缓存配置:
26
+
27
+ ```typescript
28
+ export default {
29
+ // ... 其他配置
30
+
31
+ "CacheStore": {
32
+ type: "memory", // 缓存类型: "redis" 或 "memory",默认为 "memory"
33
+ // Redis 配置 (当 type 为 "redis" 时)
34
+ // key_prefix: "koatty",
35
+ // host: '127.0.0.1',
36
+ // port: 6379,
37
+ // name: "",
38
+ // username: "",
39
+ // password: "",
40
+ // db: 0,
41
+ // timeout: 30,
42
+ // pool_size: 10,
43
+ // conn_timeout: 30
44
+ },
45
+
46
+ // ... 其他配置
47
+ };
48
+ ```
49
+
50
+ ## 使用方法
51
+
52
+ ### 基本用法
53
+
54
+ ```typescript
55
+ import { CacheAble, CacheEvict, GetCacheStore } from "koatty_cacheable";
56
+
57
+ export class UserService {
58
+
59
+ // 自动缓存方法返回值
60
+ @CacheAble("userCache", {
61
+ params: ["id"], // 使用 id 参数作为缓存键的一部分
62
+ timeout: 300 // 缓存过期时间(秒),默认 300 秒
63
+ })
64
+ async getUserById(id: string): Promise<User> {
65
+ // 数据库查询逻辑
66
+ return await this.userRepository.findById(id);
67
+ }
68
+
69
+ // 自动清除相关缓存
70
+ @CacheEvict("userCache", {
71
+ params: ["id"], // 使用 id 参数定位要清除的缓存
72
+ delayedDoubleDeletion: true // 启用延迟双删策略,默认 true
73
+ })
74
+ async updateUser(id: string, userData: Partial<User>): Promise<User> {
75
+ // 更新用户数据
76
+ const updatedUser = await this.userRepository.update(id, userData);
77
+ return updatedUser;
78
+ }
79
+
80
+ // 手动操作缓存
81
+ async customCacheOperation() {
82
+ const store = await GetCacheStore(this.app);
83
+
84
+ // 设置缓存
85
+ await store.set("custom:key", "value", 60);
86
+
87
+ // 获取缓存
88
+ const value = await store.get("custom:key");
89
+
90
+ // 删除缓存
91
+ await store.del("custom:key");
92
+ }
93
+ }
94
+ ```
95
+
96
+ ### 高级用法
97
+
98
+ ```typescript
99
+ export class ProductService {
100
+
101
+ // 无参数缓存
102
+ @CacheAble("productStats")
103
+ async getProductStats(): Promise<ProductStats> {
104
+ return await this.calculateStats();
105
+ }
106
+
107
+ // 多参数缓存
108
+ @CacheAble("productSearch", {
109
+ params: ["category", "keyword"],
110
+ timeout: 600
111
+ })
112
+ async searchProducts(category: string, keyword: string, page: number = 1): Promise<Product[]> {
113
+ return await this.productRepository.search(category, keyword, page);
114
+ }
115
+
116
+ // 立即清除缓存(不使用延迟双删)
117
+ @CacheEvict("productSearch", {
118
+ params: ["category"],
119
+ delayedDoubleDeletion: false
120
+ })
121
+ async updateProductCategory(category: string, updates: any): Promise<void> {
122
+ await this.productRepository.updateCategory(category, updates);
123
+ }
124
+ }
125
+ ```
126
+
127
+ ## API 文档
128
+
129
+ ### @CacheAble(cacheName, options?)
130
+
131
+ 自动缓存装饰器,缓存方法的返回值。
132
+
133
+ **参数:**
134
+ - `cacheName: string` - 缓存名称
135
+ - `options?: CacheAbleOpt` - 缓存选项
136
+ - `params?: string[]` - 用作缓存键的参数名数组
137
+ - `timeout?: number` - 缓存过期时间(秒),默认 300
138
+
139
+ ### @CacheEvict(cacheName, options?)
140
+
141
+ 自动清除缓存装饰器,在方法执行后清除相关缓存。
142
+
143
+ **参数:**
144
+ - `cacheName: string` - 要清除的缓存名称
145
+ - `options?: CacheEvictOpt` - 清除选项
146
+ - `params?: string[]` - 用于定位缓存的参数名数组
147
+ - `delayedDoubleDeletion?: boolean` - 是否启用延迟双删策略,默认 true
148
+
149
+ ### GetCacheStore(app?)
150
+
151
+ 获取缓存存储实例。
152
+
153
+ **参数:**
154
+ - `app?: Application` - Koatty 应用实例
155
+
156
+ **返回:** `Promise<CacheStore>`
157
+
158
+ ## 缓存键生成规则
159
+
160
+ 缓存键按以下格式生成:
161
+ ```
162
+ {cacheName}:{paramName1}:{paramValue1}:{paramName2}:{paramValue2}...
163
+ ```
164
+
165
+ 例如:
166
+ - `@CacheAble("user", {params: ["id"]})` + `getUserById("123")` → `user:id:123`
167
+ - 当缓存键长度超过 128 字符时,会自动使用 murmur hash 进行压缩
168
+
169
+ ## 延迟双删策略
170
+
171
+ 延迟双删是一种解决缓存一致性问题的策略:
172
+
173
+ 1. 立即删除缓存
174
+ 2. 执行数据更新操作
175
+ 3. 延迟 5 秒后再次删除缓存
176
+
177
+ 这样可以避免在并发场景下出现脏数据。
178
+
179
+ ## 注意事项
180
+
181
+ 1. 装饰器只能用于 `SERVICE` 和 `COMPONENT` 类型的类
182
+ 2. 被装饰的方法必须是异步方法(返回 Promise)
183
+ 3. 缓存的数据会自动进行 JSON 序列化/反序列化
184
+ 4. 如果缓存服务不可用,方法会正常执行,不会抛出错误
185
+
186
+ ## 许可证
187
+
188
+ BSD-3-Clause
package/dist/LICENSE CHANGED
@@ -1,29 +1,29 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2020, Koatty
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- 3. Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2020, Koatty
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.