Skip to content

russtelen/KAP-CACHE-MGMT

Repository files navigation

KORE Software / KAP Cache Management

About The Project

Screenshot

The Konnect product leverages an internal facing administration portal we have built to aid KORE employees to manage the products client base. The KONNECT Admin Portal (KAP) currently provides the internal members the ability to create, update and read the products client list as well as customize the configurations for the individual client by turning on/off different setting toggles. We want to expand the functionality of the KAP to also help us manage the product's caches. Currently KONNECT has implemented a Redis cache on AWS that we use extensively across the application. At the moment, the dev team has no way to visualize and/or interact with the keys on the cache outside of custom console applications that we write on an as needed basis. We, the dev team, have been talking about building a portal that would allow us to interact withthe keys in a more efficient way than building/manipulating console applications

Essential Feautures

  1. An application for the internal team to interact with the Redis cache that has the following functionalities:
    • Ability to read from a well-organized list / grid
    • Paginated results
    • Number of existing keys ranges between 1,000 < x < 1,000,000
    • Search functionality with the ability to search the entire list of keys by pattern
  2. The dev team should be able to perform the following CRUD operations
    • Create new key value pair
    • Retrieve paginated key list
    • Retrieve value of selected key
    • Remove individual key
    • Remove keys by pattern
    • Remove keys by selection

Additional features

  • Configurable / dynamic filtering
  • Redis key pattern generator

Built With

API Documentation

View API Documentation here

Getting Started

Redis Installation Guide

Installing Redis on Windows with Ubuntu
  1. Download ubuntu from Microsoft Store

  2. Run this following command lines on Ubuntu

$ sudo apt-get update
$ sudo apt-get upgrade

  1. Installing Redis on Ubuntu

$ sudo apt-get install redis-server

  1. Start Redis server on Ubuntu

$ redis-server

  1. To Test if Redis server is running

$ redis-cli ping
$ PONG << expected reply

Installing Redis on Mac with Brew
  1. Download and Install Homebrew

  2. Update and Install Redis on Brew

brew update
brew install redis

  1. To start Redis server

brew services start redis

  1. To stop Redis server

brew services stop redis

  1. To Test if Redis server is running

redis-cli ping
PONG << expected reply

How to SET and GET Redis key

Redis-cli SET "Key1" "Value1"
OK << expected reply
Redis-cli GET "Key1"
"Value1" << expected reply

Prerequisites

  • Microsoft Visual Studio
  • .NET Core 3.1
  • Ubuntu
  • Redis
  • NodeJS To get a local copy up and running follow these steps.

Installation (Server Side)

  1. Clone the repo

    git clone https://github.com/nkrachangtoy/kap-cache-management.git
    
  2. Go to /server/KONNECT-REDIS

    cd server/KONNECT-REDIS
    
  3. Double click KONNECT-REDIS.sln to open the project

  4. Rename appsettingsSAMPLE.json and appsettingsSAMPLE.Development.json to appsettings.json and appsettings.Development.json repectively

  5. Install Nuget Packages From within Visual Studio you can use the Package Manager Console to also update the packages. This has the benefit that any PowerShell scripts will be run as part of the update where as using NuGet.exe will not run them. The following command will update all packages in every project to the latest version available from nuget.org. Update-Package

  6. Inside Startup.cs (Optional) If you want to use the interactive API Documentation with Swagger, uncomment the following outlined code blocks:

     //=============================================================================
     // UNCOMMENT THIS BLOCK DURING LOCAL DEV FOR DOCUMENTATION (SWAGGER CONFIG)
     //=============================================================================
     services.AddSwaggerGen(options =>
     {
         options.SwaggerDoc("KonnectAPI",
             new Microsoft.OpenApi.Models.OpenApiInfo()
             {
                 Title = "Konnect - Redis Cache - API",
                 Version = "1",
                 Description = "API Documentation by Konnect Dev Team"
             });
         options.IncludeXmlComments("KONNECT-REDIS.xml");
     });
     //=============================================================================
     // UNCOMMENT THIS BLOCK DURING LOCAL DEV FOR DOCUMENTATION (SWAGGER CONFIG)
     //=============================================================================
     ....
     //=============================================================================
     // UNCOMMENT THIS BLOCK DURING LOCAL DEV FOR DOCUMENTATION (SWAGGER CONFIG)
     //=============================================================================
     app.UseSwagger();
     app.UseSwaggerUI(options =>
     {
         options.SwaggerEndpoint("/swagger/KonnectAPI/swagger.json", "Konnect - Redis Cache - API");
         options.RoutePrefix = "";
     });
     //=============================================================================
     // UNCOMMENT THIS BLOCK DURING LOCAL DEV FOR DOCUMENTATION (SWAGGER CONFIG)
     //=============================================================================
    
  7. To connect to local Redis server, open Starup.cs and add the following code:

    public void ConfigureServices(IServiceCollection services)
    {
        [...]
        // Configure Redis Connection
        var options = new ConfigurationOptions
        {
            EndPoints = { "localhost:<YOUR_REDIS_PORT>" },
        };
        services.AddSingleton<IConnectionMultiplexer>(
              ConnectionMultiplexer.Connect(options));
        [...]
    

    And change your Redis .GetServer() in KeyService.cs

    public KeysService(IConnectionMultiplexer multiplexer, IConfiguration configuration)
         {
             _multiplexer = multiplexer;
             Configuration = configuration;
             _db = _multiplexer.GetDatabase();
             _server = _multiplexer.GetServer("localhost", <YOUR_REDIS_PORT>);
             _keys = _server.Keys(0, pattern: "*", pageSize: 100000);
             _regex = new Regex(@"^[0-9]+$");
         }
    
  8. Run the app by pressing F5

Pacakges used (Server Side)

Installation (Client Side)

  1. Within the client folder of the repo, run npm install to install packages
  2. To start the app locally, run npm start
Pacakges used (Client Side)

User Notes

  1. The Delete function has two modes:
    • If nothing is selected and the delete button is pressed, a query drawer will open and bulk delete can be done by Redis Query
    • If there are selections, the selections will be deleted and the query drawer will not open
  2. Searching must be done by Redis query
    • for example "IsFeature" will produce no results, but "IsFeature*" will result in all keys that start with "IsFeature".

Contributors

Nusorn Krachangtoy

Sabrina Kuah

Simon Currie

Russell Telen

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published