{"id":15104878,"url":"https://github.com/larsundso/pg-x-redis","last_synced_at":"2025-09-27T02:32:39.376Z","repository":{"id":57798431,"uuid":"527971490","full_name":"Larsundso/PG-x-Redis","owner":"Larsundso","description":"PG x Redis utilizes Redis, RedisJSON and RediSearch to speed up PostgreSQL Queries by caching Data into Redis and Selecting Redis Data over PostgreSQL Data.","archived":true,"fork":false,"pushed_at":"2023-10-17T08:42:11.000Z","size":421,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T02:34:49.655Z","etag":null,"topics":["postgres","postgresql","redis"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Larsundso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-23T12:03:25.000Z","updated_at":"2023-10-17T08:42:19.000Z","dependencies_parsed_at":"2022-08-23T16:11:20.866Z","dependency_job_id":"35c28f1d-02b1-4141-a783-fcae20e2057e","html_url":"https://github.com/Larsundso/PG-x-Redis","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":0.04347826086956519,"last_synced_commit":"4e8a2b8d45ec6b88e930955875df35ad42be8083"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Larsundso%2FPG-x-Redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Larsundso%2FPG-x-Redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Larsundso%2FPG-x-Redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Larsundso%2FPG-x-Redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Larsundso","download_url":"https://codeload.github.com/Larsundso/PG-x-Redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234376917,"owners_count":18822416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgres","postgresql","redis"],"created_at":"2024-09-25T20:03:28.710Z","updated_at":"2025-09-27T02:32:34.060Z","avatar_url":"https://github.com/Larsundso.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PG x Redis\n\nPG x Redis utilizes Redis, RedisJSON and RediSearch to speed up PostgreSQL Queries by caching Data into Redis and Selecting Redis Data over PostgreSQL Data.\n\n## Prerequisites\n\nTo use this Package, your Server needs Redis, RedisJSON, RediSearch and PostgreSQL.\n\n### Getting started\n\n```js\nimport RedisXpSQL from 'PG-x-Redis';\n\nconst DataBase = new RedisXpSQL(\n  { // Postgres Config\n    database: 'DataBase Name',\n    user: 'DataBase User',\n    password: 'DataBase Password',\n    port: 5432,\n    host: 'DataBase Host',\n  },\n  { // Redis Config\n    password: 'DataBase Password',\n    host: 'DataBase Host',\n    name: 'DataBase Alias',\n  },\n);\n\nawait DataBase.init();\n```\n\u003cbr\u003e\n\nThis Package only supports simple Queries and 4 types of Actions\u003cbr\u003e\n**Notice**: Only use this Packages `query()` Function on PostgreSQL Tables with defined Primary Keys.\n\u003cbr\u003e It uses Primary Keys to save Data in Redis as it is a KeyValue Storage.\u003cbr\u003e\nPackage does not support `IN`, `NOT IN` and `BETWEEN` Conditions *yet*\n\n### Supported Action Types\n\n`INSERT`\n```js\nawait DataBase.query(\n    `INSERT INTO userinfo (firstname, lastname, email, age) VALUES ($1, $2, $3, $4);`,\n    [ 'John', 'Doe', 'JohnDoe@mail.com', 24],\n);\n// Response \u003e [{ firstname: 'John', lastname: 'Doe', email: 'JohnDoe@mail.com', age: 24 }]\n```\n\n`UPDATE` \n```js\nawait DataBase.query(\n    `UPDATE userinfo SET age = $1 WHERE firstname = $2 AND lastname = $3;`,\n    [ 25, 'John', 'Doe' ],\n);\n// Response \u003e [{ 'John', 'Doe',  'JohnDoe@mail.com', 25 }]\n```\n\n`SELECT` \n```js\nawait DataBase.query(\n    `SELECT * FROM userinfo WHERE age = $1`,\n    [ 25 ],\n);\n// Response \u003e [{ 'John', 'Doe',  'JohnDoe@mail.com', 25 }]\n```\n\n`DELETE`\n```js\nawait DataBase.query(\n    `DELETE FROM userinfo WHERE email = $1`,\n    [ 'JohnDoe@mail.com' ],\n);\n// Response \u003e [{ 'John', 'Doe',  'JohnDoe@mail.com', 25 }]\n```\n\n### Query Replacements\nReplacements can only be passed in Array Form for `pg` Data Sanitization\n\n#### Redis Client\n```js\nDataBase.redis\nDataBase.redis.json.get('Key')\nDataBase.redis.ft.search('Index Key', 'Redis Query')\n// etc...\n```\n#### PostgreSQL Client\n```js\nDataBase.postgres\nDataBase.postgres.query(`PSQL Query`, [ 'SQL Options' ])\n// etc...\n```\n\n### ! Warning ! for raw Interactions with Redis and PostgreSQL Clients\nChanged Data will not be cached\n\n## Contributing\nI will happily accept your pull request if it:\n- looks reasonable\n- does not break backwards compatibility\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarsundso%2Fpg-x-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarsundso%2Fpg-x-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarsundso%2Fpg-x-redis/lists"}