Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Type definitions for keyv 3.1
  2. // Project: https://github.com/lukechilds/keyv
  3. // Definitions by: AryloYeung <https://github.com/Arylo>
  4. // BendingBender <https://github.com/BendingBender>
  5. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
  6. // TypeScript Version: 2.8
  7. /// <reference types="node" />
  8. import { EventEmitter } from 'events';
  9. declare class Keyv<TValue = any> extends EventEmitter {
  10. /**
  11. * @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
  12. */
  13. constructor(opts?: Keyv.Options<TValue>);
  14. /**
  15. * @param uri The connection string URI.
  16. *
  17. * Merged into the options object as options.uri.
  18. * @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
  19. */
  20. constructor(uri?: string, opts?: Keyv.Options<TValue>);
  21. /** Returns the value. */
  22. get(key: string): Promise<TValue | undefined>;
  23. /**
  24. * Set a value.
  25. *
  26. * By default keys are persistent. You can set an expiry TTL in milliseconds.
  27. */
  28. set(key: string, value: TValue, ttl?: number): Promise<true>;
  29. /**
  30. * Deletes an entry.
  31. *
  32. * Returns `true` if the key existed, `false` if not.
  33. */
  34. delete(key: string): Promise<boolean>;
  35. /** Delete all entries in the current namespace. */
  36. clear(): Promise<void>;
  37. }
  38. declare namespace Keyv {
  39. interface Options<TValue> {
  40. /** Namespace for the current instance. */
  41. namespace?: string;
  42. /** A custom serialization function. */
  43. serialize?: (data: TValue) => string;
  44. /** A custom deserialization function. */
  45. deserialize?: (data: string) => TValue;
  46. /** The connection string URI. */
  47. uri?: string;
  48. /** The storage adapter instance to be used by Keyv. */
  49. store?: Store<TValue>;
  50. /** Default TTL. Can be overridden by specififying a TTL on `.set()`. */
  51. ttl?: number;
  52. /** Specify an adapter to use. e.g `'redis'` or `'mongodb'`. */
  53. adapter?: 'redis' | 'mongodb' | 'mongo' | 'sqlite' | 'postgresql' | 'postgres' | 'mysql';
  54. [key: string]: any;
  55. }
  56. interface Store<TValue> {
  57. get(key: string): TValue | Promise<TValue | undefined> | undefined;
  58. set(key: string, value: TValue, ttl?: number): any;
  59. delete(key: string): boolean | Promise<boolean>;
  60. clear(): void | Promise<void>;
  61. }
  62. }
  63. export = Keyv;