Question

In: Computer Science

redis cache has a gridview How can the gridview display only certain rows eg, when user...

redis cache has a gridview How can the gridview display only certain rows eg, when user inputs in textbox and clicks the button, the gridview will only display the rows which has data equal to the textbox data Language C#

no sql is used

how to display data from grid view using condition without sql

Solutions

Expert Solution

Redis is a NoSQL key-value cache that stores the information in a hash table format, providing the possibilities to store different types of structured data like strings, hashes, lists, sets, sorted sets, bitmaps and hyper loglogs.

Installing REDIS on Windows-

Officially Redis doesn't have an official version for windows, but being an open-source project,

Requirements to install Redis:

  1. 64 bit OS
  2. The windows package manager Chocolatey

In order to install Redis on Windows using Chocolatey, we need to run a simple command with the command prompt (as administrator)

C:\> choco install redis-64

Once the installation is complete, we can run the Redis server instance using the command redis-server.exe. If you have problems running the command and get the error "redis-server is not recognized as an internal...etc" is because chocolatey failed registering the system path variable indicating where Redis is. You can fix it with the following command:

SET PATH=%PATH%;"c:\Program Files\Redis"

Now we can run the redis-server.exe to start our Redis instance.

Once this package is installed, we are going to create a new class named RedisConnectorHelper.cs. In order to have an easy way to manage our connection to redis,

we type the following:

public class RedisConnectorHelper

{

static RedisConnectorHelper()

{

RedisConnectorHelper.lazyConnection = new Lazy<ConnectionMultiplexer>(() =>

{

return ConnectionMultiplexer.Connect("localhost");

});

}

private static Lazy<ConnectionMultiplexer> lazyConnection;

public static ConnectionMultiplexer Connection

{

get

{

return lazyConnection.Value;

}

}

}

Setting and Getting data from the cache :-

class Program  

{  

    static void Main(string[] args)  

    {  

        var program = new Program();  

        Console.WriteLine("Saving random data in cache");  

        program.SaveBigData();  

        Console.WriteLine("Reading data from cache");  

        program.ReadData();  

        Console.ReadLine();  

    }  

    public void ReadData()  

    {  

        var cache = RedisConnectorHelper.Connection.GetDatabase();  

        var devicesCount = 10000;  

        for (int i = 0; i < devicesCount; i++)  

        {  

            var value = cache.StringGet($"Device_Status:{i}");  

            Console.WriteLine($"Valor={value}");  

        }  

    }  

    public void SaveBigData()  

    {  

        var devicesCount = 10000;  

        var rnd = new Random();  

        var cache = RedisConnectorHelper.Connection.GetDatabase();  

        for (int i = 1; i < devicesCount; i++)  

        {  

            var value = rnd.Next(0, 10000);  

            cache.StringSet($"Device_Status:{i}", value);  

        }  

    }  

}  


Related Solutions

What is the only body system eg. ( skeletal, nervous systems) the human being can live...
What is the only body system eg. ( skeletal, nervous systems) the human being can live without and why?
How would you design a cache coherence with only MS, not MSI. How do you manage...
How would you design a cache coherence with only MS, not MSI. How do you manage the new protocol? Draw the new MS protocol. For each state, show all the relevant transitions. In the new MSI protocol, when does a memory read occur? Specify the bus transaction, the requestor's start and end states, and the states of the other caches if relevant. In the new MSI protocol, when does a memory write occur? Specify the bus transaction and the requestor's...
create a Visual Basic project with the following features: 1. The user interface can display the...
create a Visual Basic project with the following features: 1. The user interface can display the following information, one textbox for one item: 1a. Author, in the form of Lastname, Firstname 1b. Title 1c. Source -- where the paper is published 1d. Abstract 1e. Publication year (This information is in the 1c. Source, but display the publication year separately here) 2. There is a command button "Import". It would allow the user to select the eric.txt as the input file...
Display a simple message "Welcome" on your demo webpage. When the user hovers over the message,...
Display a simple message "Welcome" on your demo webpage. When the user hovers over the message, a popup should be displayed with a message "Welcome to our new WebPage!!!".
When a user signs in for the first time to a website, the user has to...
When a user signs in for the first time to a website, the user has to submit personal information, such as userid, name, email address, telephone number and so on. Typically, there are two fields for passwords, requiring the user to enter the password twice, to ensure that the user did not make a typo in the first password field. Write a class encapsulating user with the following elements: UserID Password Reentered password Email address Name Street Address City State...
1 How can we specify the number of rows and columns in a grid layout? 2....
1 How can we specify the number of rows and columns in a grid layout? 2. What happens when we don't have enough items to be displayed in a grid layout with a specified size? 3. How can we specify a grid layout component to occupy more than one columns or rows? 4. What happens if the components in a linear and grid layout exceed the layout size? How can we handle this problem so that all components can be...
How can policy issues cause water scarcity? (for eg: in Bolivia) (50-100 words).
How can policy issues cause water scarcity? (for eg: in Bolivia) (50-100 words).
in electric heater, why when we touch it is not conducive?   also how can only the...
in electric heater, why when we touch it is not conducive?   also how can only the heater heats up while the wire is cold????
How can user error be controlled? Is it unavoidable?
How can user error be controlled? Is it unavoidable?
How a project may be affected if User Involvement does not exist for a certain project...
How a project may be affected if User Involvement does not exist for a certain project and techniques that a project manager may employ to help ensure that they are in place.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT