{"_id":"@bilalatli/nestjs-redis-bloomfilter","_rev":"5-538565d66f45a749e9a015804361be7a","name":"@bilalatli/nestjs-redis-bloomfilter","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.1":{"name":"@bilalatli/nestjs-redis-bloomfilter","version":"1.0.1","description":"NestJS - Redis Bloom Filters Extension","main":"index.js","types":"index.d.ts","scripts":{"build":"tsc -p tsconfig.json","prepublish":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"license":"MIT","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"dependencies":{"ioredis":"^5.3.2"},"devDependencies":{"@nestjs/common":"10.0.0","@nestjs/core":"10.0.0","@types/node":"^16.18.82","typescript":"^4.9.5","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","prettier":"^2.3.2"},"_id":"@bilalatli/nestjs-redis-bloomfilter@1.0.1","gitHead":"912c6cd01a665161c947e2a76294310b1fcaadda","_nodeVersion":"20.10.0","_npmVersion":"10.5.2","dist":{"integrity":"sha512-k5K/4uBSXLwfvB+n3001Cnp/omeFVJlcmgR4cE5uEhUAWCvs+SXWgIX9qgUTDzJ1AQR9U0G2nzGUOlNW5w6QaQ==","shasum":"0e3c16aa14e09de045fda49a100f8ebabadc2184","tarball":"https://registry.npmjs.org/@bilalatli/nestjs-redis-bloomfilter/-/nestjs-redis-bloomfilter-1.0.1.tgz","fileCount":34,"unpackedSize":107896,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLSCnanET1QoekKptABU9Bmpjn2yONgTRWAwZcrX0RMAIgHBwD7kq6VWMLz/CYd5KKXY7qbL0Waa6sLYOnTBQLlFM="}]},"_npmUser":{"name":"bilal.atli","email":"ytbilalatli@gmail.com"},"directories":{},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-redis-bloomfilter_1.0.1_1715268631242_0.33588772775181464"},"_hasShrinkwrap":false},"1.0.2":{"name":"@bilalatli/nestjs-redis-bloomfilter","version":"1.0.2","description":"NestJS - Redis Bloom Filters Extension","main":"index.js","types":"index.d.ts","scripts":{"build":"tsc -p tsconfig.json","prepublish":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"license":"MIT","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"dependencies":{"ioredis":"^5.3.2"},"devDependencies":{"@nestjs/common":"10.0.0","@nestjs/core":"10.0.0","@types/node":"^16.18.82","typescript":"^4.9.5","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","prettier":"^2.3.2"},"_id":"@bilalatli/nestjs-redis-bloomfilter@1.0.2","gitHead":"8a45252551c33a59fcd3a5bb7b1354fff9c0a805","_nodeVersion":"20.10.0","_npmVersion":"10.5.2","dist":{"integrity":"sha512-Rz9Hkm8omwqEGUuweyY8VXJbIj0pdV07/te4SkHjUZiJMka1ofm33xPBmOTBMh/AzQzYPBlddtbfzCdYTvRmSg==","shasum":"ee6866831b35203075d63b70dd582092d19e507f","tarball":"https://registry.npmjs.org/@bilalatli/nestjs-redis-bloomfilter/-/nestjs-redis-bloomfilter-1.0.2.tgz","fileCount":30,"unpackedSize":106754,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFEDm3hiK0BkZenfcnKWFtb/Plv5r+8EFD0ET2y+WcRHAiEAmMrSNLG6JMdSDpKySAoqZ6lBPW46eVOnk56hFngu038="}]},"_npmUser":{"name":"bilal.atli","email":"ytbilalatli@gmail.com"},"directories":{},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-redis-bloomfilter_1.0.2_1715268927868_0.7866854802070085"},"_hasShrinkwrap":false},"1.0.3":{"name":"@bilalatli/nestjs-redis-bloomfilter","version":"1.0.3","description":"NestJS - Redis Bloom Filters Extension","main":"index.js","types":"index.d.ts","scripts":{"build":"tsc -p tsconfig.json","prepublish":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"license":"MIT","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"dependencies":{"ioredis":"^5.3.2"},"devDependencies":{"@nestjs/common":"10.0.0","@nestjs/core":"10.0.0","@types/node":"^16.18.82","typescript":"^4.9.5","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","prettier":"^2.3.2"},"_id":"@bilalatli/nestjs-redis-bloomfilter@1.0.3","gitHead":"53886763247e8bef4e357112dca217cac33f3616","_nodeVersion":"20.10.0","_npmVersion":"10.5.2","dist":{"integrity":"sha512-66QCpymD2sd8KMuKkbkM/SsEu30ilmIJMjRJv+P7Zhj1mOls/4y/6GrmyP0cQH+mQpcVoZKOZmF+9FnJuKXzgA==","shasum":"95eeacc7666b16e409d5b13326dcfc00db44d311","tarball":"https://registry.npmjs.org/@bilalatli/nestjs-redis-bloomfilter/-/nestjs-redis-bloomfilter-1.0.3.tgz","fileCount":52,"unpackedSize":134151,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDowPGJtgTmZjPDDwfvvFLkz2g5OGwLQypuEaZl+it3rwIgZmoxUOPBDx/e1+4WMREKMPRaUA+SFk+yoiQlK83lkFA="}]},"_npmUser":{"name":"bilal.atli","email":"ytbilalatli@gmail.com"},"directories":{},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-redis-bloomfilter_1.0.3_1715281826198_0.7487526404484974"},"_hasShrinkwrap":false},"1.0.4":{"name":"@bilalatli/nestjs-redis-bloomfilter","version":"1.0.4","description":"NestJS - Redis Bloom Filters Extension","main":"index.js","types":"index.d.ts","scripts":{"build":"tsc -p tsconfig.json","prepublish":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"license":"MIT","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"dependencies":{"ioredis":"^5.3.2"},"devDependencies":{"@nestjs/common":"10.0.0","@nestjs/core":"10.0.0","@types/node":"^16.18.82","typescript":"^4.9.5","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","prettier":"^2.3.2"},"_id":"@bilalatli/nestjs-redis-bloomfilter@1.0.4","gitHead":"f3dfcf09ab8ad4b6b30cb622c1a9681a99575ef5","_nodeVersion":"20.10.0","_npmVersion":"10.5.2","dist":{"integrity":"sha512-h1aHnaVDPXZN171TSwEF8lJXLFWqsExxKGxdgxh8tg1ZWi0PW4vMqp1KSsey5XGG7eYYmUfkhyLBnMirXATG0g==","shasum":"f6082e57d6dd8d4054ba8c39165bf5cbc793a632","tarball":"https://registry.npmjs.org/@bilalatli/nestjs-redis-bloomfilter/-/nestjs-redis-bloomfilter-1.0.4.tgz","fileCount":52,"unpackedSize":146980,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBYWWiuSR4Vkkvp8NURD/hfQ79kAEmKo39B4B/uwhCtAIgdzZ451SsICoJHAzE1/HqOHCj+29RBqA8tFks2wtWxhM="}]},"_npmUser":{"name":"bilal.atli","email":"ytbilalatli@gmail.com"},"directories":{},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-redis-bloomfilter_1.0.4_1715282207624_0.8267743486924031"},"_hasShrinkwrap":false},"1.0.5":{"name":"@bilalatli/nestjs-redis-bloomfilter","version":"1.0.5","description":"NestJS - Redis Bloom Filters Extension","main":"index.js","types":"index.d.ts","scripts":{"build":"tsc -p tsconfig.json","prepublish":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"license":"MIT","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"dependencies":{"ioredis":"^5.3.2"},"devDependencies":{"@nestjs/common":"10.0.0","@nestjs/core":"10.0.0","@types/node":"^16.18.82","typescript":"^4.9.5","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","prettier":"^2.3.2"},"_id":"@bilalatli/nestjs-redis-bloomfilter@1.0.5","gitHead":"864da9f5397f4dac6cb7ccc2695c363cb63133a4","_nodeVersion":"20.10.0","_npmVersion":"10.5.2","dist":{"integrity":"sha512-B5CSkwAm96pKqtm5Q2nkOxnZiNM+peoCiR1MjfUlbTk9ayQ92O8ls+HyNkHCdIyDpJH051ltSsATEANZ5Xfr8A==","shasum":"ca44b4c5cbc04727723f48feddff47e84514d553","tarball":"https://registry.npmjs.org/@bilalatli/nestjs-redis-bloomfilter/-/nestjs-redis-bloomfilter-1.0.5.tgz","fileCount":52,"unpackedSize":146980,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDfehsgAh68GzUF955yDwaXeWrYFdJNDd06JN44FyAl4AiBoiDh54MwpDvxVb9VEg53EV70kUaXVs+kuWbQEkYKZCw=="}]},"_npmUser":{"name":"bilal.atli","email":"ytbilalatli@gmail.com"},"directories":{},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-redis-bloomfilter_1.0.5_1715683659898_0.7462188762008448"},"_hasShrinkwrap":false},"1.0.6":{"name":"@bilalatli/nestjs-redis-bloomfilter","version":"1.0.6","description":"NestJS - Redis Bloom Filters Extension","main":"index.js","types":"index.d.ts","scripts":{"build":"tsc -p tsconfig.json","prepublish":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"license":"MIT","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"dependencies":{"ioredis":"^5.3.2"},"devDependencies":{"@nestjs/common":"10.0.0","@nestjs/core":"10.0.0","@types/node":"^16.18.82","typescript":"^4.9.5","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","prettier":"^2.3.2"},"_id":"@bilalatli/nestjs-redis-bloomfilter@1.0.6","gitHead":"bdc17897728d401d3b7200801daa98f4821c6ff8","_nodeVersion":"20.10.0","_npmVersion":"10.5.2","dist":{"integrity":"sha512-dYJYDeBIkd4u9bDDcl5yAdt9a3xZZIIHWotEhCI0HNtNqlqqlopUSXToUdGLI1hrwt6C+iyExa9+fFJCRbEQVw==","shasum":"d6337431340efac72d0f2abde6133d8c0252edfb","tarball":"https://registry.npmjs.org/@bilalatli/nestjs-redis-bloomfilter/-/nestjs-redis-bloomfilter-1.0.6.tgz","fileCount":52,"unpackedSize":147024,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCY15eKbNV9RQy6vF5+I/gSJb5uUHhvqnLL6NUMtnOiJwIgCm3JfNM1Zefbs5qYD4l3j+X7fNWdxu7ZJvjHSbQDO9U="}]},"_npmUser":{"name":"bilal.atli","email":"ytbilalatli@gmail.com"},"directories":{},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-redis-bloomfilter_1.0.6_1715683933644_0.11848358207952803"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-09T15:30:31.123Z","1.0.1":"2024-05-09T15:30:31.415Z","modified":"2024-05-14T10:52:14.009Z","1.0.2":"2024-05-09T15:35:28.047Z","1.0.3":"2024-05-09T19:10:26.362Z","1.0.4":"2024-05-09T19:16:47.788Z","1.0.5":"2024-05-14T10:47:40.029Z","1.0.6":"2024-05-14T10:52:13.804Z"},"maintainers":[{"name":"bilal.atli","email":"ytbilalatli@gmail.com"}],"description":"NestJS - Redis Bloom Filters Extension","homepage":"https://github.com/bilalatli/nestjs-redis-bloomfilter#readme","keywords":["nestjs-bloomfilter","nestjs","bloom","filters","redis"],"repository":{"type":"git","url":"git+https://github.com/bilalatli/nestjs-redis-bloomfilter.git"},"author":{"name":"Bilal ATLI","email":"ytbilalatli[at]gmail.com"},"bugs":{"url":"https://github.com/bilalatli/nestjs-redis-bloomfilter/issues"},"license":"MIT","readme":"# @bilalatli/nestjs-redis-bloomfilter\r\nA Bloom filter is a probabilistic data structure in Redis Stack that enables you to check if an element is present in a set using a very small memory space of a fixed size.\r\n\r\nInstead of storing all of the elements in the set, Bloom Filters store only the elements' hashed representation, thus sacrificing some precision. The trade-off is that Bloom Filters are very space-efficient and fast.\r\n\r\n### Use Cases\r\n- Financial fraud detection (Finance)\r\n- Ad placement (Retail, Advertising)\r\n- Check if a username is taken (SaaS, Content publishing platforms)\r\n- ...\r\n\r\n---\r\n\r\nThis package provides an extension for [NestJS](https://github.com/nestjs/nest) to enable the use of the RedisStack - Bloom Filter module\r\n\r\n## Installation\r\n```\r\nnpm install @bilalatli/nestjs-redis-bloomfilter\r\n```\r\n\r\n## Module Installation #1\r\n\r\nIn this example you must install [**@nestjs-modules/ioredis**](https://www.npmjs.com/package/@nestjs-modules/ioredis) package.\r\n\r\nOr you can use another method to inject existing ioredis client into the module. \r\n\r\n```Typescript\r\n// app.module.ts\r\nimport { getRedisConnectionToken, RedisModule } from '@nestjs-modules/ioredis';\r\nimport { BloomFilterModule, BloomFilterService } from '@bilalatli/nestjs-redis-bloomfilter';\r\n\r\n@Module({\r\n  imports: [\r\n    ...\r\n    // You should import RedisModule first\r\n    RedisModule.forRoot({\r\n      type: 'single',\r\n      url: 'redis://localhost:6379',\r\n    }),\r\n    BloomFilterModule.registerAsync({\r\n      inject: [getRedisConnectionToken()],\r\n      useFactory: async (redis: Redis): Promise<IBloomFilterOptions> => {\r\n        return {\r\n          client: redis,\r\n        };\r\n      },\r\n    }),\r\n  ]\r\n})\r\nexport class AppModule {\r\n}\r\n```\r\n\r\n## Module Installation #2\r\n\r\nIn this example you must install [**@ioredis**](https://www.npmjs.com/package/ioredis) package.\r\n\r\n```Typescript\r\n// app.module.ts\r\nimport { BloomFilterModule, BloomFilterService } from '@bilalatli/nestjs-redis-bloomfilter';\r\n\r\n@Module({\r\n  imports: [\r\n    ...\r\n    BloomFilterModule.registerAsync({\r\n      useFactory: async (): Promise<IBloomFilterOptions> => {\r\n        return {\r\n          connection: {\r\n            host: '127.0.0.1', // Default: 127.0.0.1\r\n            port: 6379, // Default: 6379\r\n            // username: '', // @Optional\r\n            // password: '', // @Optional\r\n            // db: 0 // @Optional\r\n          }\r\n        };\r\n      },\r\n    }),\r\n  ]\r\n})\r\nexport class AppModule {\r\n}\r\n```\r\n\r\n## Usage Example\r\n\r\n```Typescript\r\nimport {Inject, Injectable} from \"@nestjs/common\";\r\nimport {BloomFilterService} from \"@bilalatli/nestjs-redis-bloomfilter\";\r\n\r\n@Injectable()\r\nexport class AppService {\r\n  @Inject() bf: BloomFilterService;\r\n\r\n  public async example() {\r\n    const key = 'username';\r\n\r\n    // Reserve `username` filter with 0.1% error rate (false positive) & 20.000 item capacity > Expansion rate : 2\r\n    await this.bf.reserve(key, 0.1, 20000, 2);\r\n\r\n    // Add my_username1 into `username` filter\r\n    await this.bf.add(key, 'my_username1');\r\n\r\n    // Add array into the `username` filter\r\n    await this.bf.mAdd(key, ['my_username1','my_username2','my_username3']);\r\n  }\r\n\r\n  public async isUsernameExists() {\r\n    const isUsernameExists = await this.bf.exists('username','my_username1');\r\n    if (isUsernameExists === false) {\r\n      // my_username1 don't exists on database & filter\r\n    } else {\r\n      // my_username1 could exist in the database. The likelihood of encountering a false-positive output is determined based on the error rate defined for the filter\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n# Methods List\r\n\r\n## Method: `add`\r\n\r\nAdds an item to a Bloom filter.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.add/)\r\n- **Parameters**:\r\n    - `key`: Key of the bloom filter.\r\n    - `item`: Item to add.\r\n- **Throws**:\r\n    - `NonScalingFilterIsFull`: Thrown if the given non-scaling bloom filter key has reached its maximum capacity.\r\n    - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n\r\n---\r\n\r\n## Method: `card`\r\n\r\nReturns the cardinality of a Bloom filter, which is the number of items that were added to the Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter).\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.card/)\r\n- **Parameters**:\r\n    - `key`: The key of the Bloom filter.\r\n- **Throws**:\r\n    - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<number>`: A promise that resolves to the cardinality of the Bloom filter.\r\n\r\n---\r\n\r\n## Method: `exists`\r\n\r\nDetermines whether a given item was added to a Bloom filter.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.exists/)\r\n- **Parameters**:\r\n    - `key`: The key of the Bloom filter.\r\n    - `item`: The item to check for existence.\r\n- **Throws**:\r\n    - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<boolean>`: A promise that resolves to a boolean indicating whether the item exists in the Bloom filter.\r\n\r\n---\r\n\r\n## Method: `info`\r\n\r\nReturns information about a Bloom filter. When no optional argument is specified, it returns all information fields.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.info/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `attribute` (optional): Optional attribute.\r\n- **Throws**:\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<number | IBloomFilterInfo>`: A promise that resolves to either a number or an object containing information about the Bloom filter.\r\n\r\nIf `attribute` is provided, the return type is `number`, representing the value of the specific attribute. Otherwise, the return type is `IBloomFilterInfo`, an object containing various information fields about the Bloom filter.\r\n\r\n---\r\n\r\n## Method: `insert`\r\n\r\nCreates a new Bloom filter if the key does not exist using the specified error rate, capacity, and expansion, then adds all specified items to the Bloom Filter.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.insert/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `items`: The items to insert into the Bloom filter.\r\n  - `capacity` (optional): The capacity of the Bloom filter.\r\n  - `errorRate` (optional): The error rate of the Bloom filter.\r\n  - `expansion` (optional): The expansion rate of the Bloom filter.\r\n  - `flags` (optional): Insert flags.\r\n- **Throws**:\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<number[]>`: A promise that resolves to an array of numbers representing the results of the insert operation for each item.\r\n\r\nThis method creates a new Bloom filter with the specified parameters if the key does not exist, and then inserts all specified items into the Bloom filter. It returns an array of numbers representing the results of the insert operation for each item.\r\n\r\n---\r\n\r\n## Method: `loadChunk`\r\n\r\nRestores a Bloom filter previously saved using BF.SCANDUMP.\r\n\r\n- **Link**: [BF.LOADCHUNK Documentation](https://redis.io/docs/latest/commands/bf.loadchunk/)\r\n- **Related Link**: [BF.SCANDUMP Documentation](https://redis.io/docs/latest/commands/bf.scandump/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `iterator`: The iterator.\r\n  - `data`: Binary chunk data.\r\n- **Throws**:\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<boolean>`: A promise that resolves to a boolean indicating whether the restoration was successful.\r\n\r\nThis method restores a Bloom filter previously saved using BF.SCANDUMP. It takes the key of the Bloom filter, the iterator, and the binary chunk data as parameters. It returns a promise that resolves to a boolean indicating whether the restoration was successful.\r\n\r\n---\r\n\r\n## Method: `mAdd`\r\n\r\nAdds one or more items to a Bloom filter.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.madd/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `items`: An array of items to add to the Bloom filter.\r\n- **Throws**:\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<number[]>`: A promise that resolves to an array of numbers representing the results of the add operation for each item.\r\n\r\nThis method adds one or more items to a Bloom filter specified by the key. It returns a promise that resolves to an array of numbers representing the results of the add operation for each item.\r\n\r\n---\r\n\r\n## Method: `mExists`\r\n\r\nDetermines whether one or more items were added to a Bloom filter.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.mexists/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `items`: An array of items to check for existence in the Bloom filter.\r\n- **Throws**:\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<number[]>`: A promise that resolves to an array of numbers representing the results of the mExists operation for each item.\r\n\r\nThis method determines whether one or more items were added to a Bloom filter specified by the key. It returns a promise that resolves to an array of numbers representing the results of the mExists operation for each item.\r\n\r\n---\r\n\r\n## Method: `reserve`\r\n\r\nCreates an empty Bloom filter with a single sub-filter for the initial specified capacity and with an upper bound error rate.\r\n\r\nBy default, the filter auto-scales by creating additional sub-filters when capacity is reached. The new sub-filter is created with a size of the previous sub-filter multiplied by the expansion parameter.\r\n\r\nThough the filter can scale up by creating sub-filters, it is recommended to reserve the estimated required capacity since maintaining and querying sub-filters requires additional memory (each sub-filter uses extra bits and hash functions) and consumes further CPU time than an equivalent filter that had the right capacity at creation time.\r\n\r\nThe number of hash functions is calculated using the formula: -log(errorRate)/ln(2)^2. The number of bits per item is calculated using the formula: -log(errorRate)/ln(2) ≈ 1.44.\r\n\r\nFor example:\r\n- A 1% error rate requires 7 hash functions and 10.08 bits per item.\r\n- A 0.1% error rate requires 10 hash functions and 14.4 bits per item.\r\n- A 0.01% error rate requires 14 hash functions and 20.16 bits per item.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.reserve/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `errorRate`: The desired probability for false positives, specified as a decimal value between 0 and 1.\r\n  - `capacity`: The number of entries intended to be added to the filter.\r\n  - `expansion` (optional): When capacity is reached, an additional sub-filter is created. The size of the new sub-filter is the size of the last sub-filter multiplied by the expansion parameter, specified as a positive integer. Default value is 2.\r\n- **Throws**:\r\n  - `FilterAlreadyExists`: Thrown if the filter key already exists.\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<boolean>`: A promise that resolves to a boolean indicating whether the reservation was successful.\r\n\r\n---\r\n\r\n## Method: `scanDump`\r\n\r\nBegins an incremental save of the Bloom filter.\r\n\r\nThis command is useful for large Bloom filters that cannot fit into the DUMP and RESTORE model.\r\n\r\nThe first time this command is called, the value of the iterator should be 0.\r\n\r\nThis command returns successive (iter, data) pairs until (0, NULL) to indicate completion.\r\n\r\n- **Link**: [Documentation](https://redis.io/docs/latest/commands/bf.scandump/)\r\n- **Parameters**:\r\n  - `key`: The key of the Bloom filter.\r\n  - `iterator`: The iterator.\r\n- **Throws**:\r\n  - `BloomFilterUnknownException`: Thrown if the exception type is not defined.\r\n- **Return Type**: `Promise<[number, Buffer]>`: A promise that resolves to an array containing the iterator value and a Buffer object representing the data.\r\n\r\nThis method begins an incremental save of the Bloom filter specified by the key. It returns successive (iterator, data) pairs until (0, NULL) to indicate completion.\r\n","readmeFilename":"README.md"}