* 简单的输入哈希函数
(input: any)
| 257 | * 简单的输入哈希函数 |
| 258 | */ |
| 259 | private hashInput(input: any): string { |
| 260 | const str = JSON.stringify(input); |
| 261 | let hash = 0; |
| 262 | for (let i = 0; i < str.length; i++) { |
| 263 | const char = str.charCodeAt(i); |
| 264 | hash = (hash << 5) - hash + char; |
| 265 | hash = hash & hash; // Convert to 32-bit integer |
| 266 | } |
| 267 | return Math.abs(hash).toString(36); |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * 估算缓存项大小 |
no outgoing calls
no test coverage detected