Redis installation and Simple example

Source: Internet
Author: User
Tags benchmark redis server

Redis installation and Simple example

One, the installation of Redis

Redis is as follows: Https://github.com/dmajkic/redis/downloads

After decompression, according to the actual situation of their own machine choose 32 or 64 bits. Download the following image:

  

    1. Redis-server.exe Daemon Boot program for Redis server
    2. redis.conf Redis configuration file
    3. Redis-cli.exe Redis Command-line Operations tool. Of course, you can also use Telnet to manipulate it based on its plain text protocol.
    4. Redis-check-dump.exe Local Database Check
    5. Redis-check-aof.exe Update Log Check
    6. Redis-benchmark.exe performance test to simulate the simultaneous sending of M-Sets/gets queries by n clients (similar to the Apache AB tool)

The Redis-server.exe in is its service-side program. Double-click it to run.

  

If you want to set up this service as a Windows system service, download the Redis Service installation software (https://github.com/rgl/redis/downloads) and install it.

Installation is complete in the service ( right-click My Computer-management-services and applications-services ) to find this service, set it to automatically delay startup.

  

Under the Redis folder, locate the Redis-cli.exe file, which is the Redis client program.

  Open input: Set name Jerry

That is, the data is inserted in Redis with a key of Name,value as Jerry.

  Continue input: Get name

Get the value of the data saved by Jerry.

  

Use: Keys * To find out how many data Redis has saved

  

Ii. using Redis in ASP.

1. First use NuGet to install a C # Redis client for the Redis NoSQL DB.

  

Actually is Servicestack.redis, this is the website recommended C # client.

Here's a look at the simplest example:

Public ActionResult Index () {    Redisclientmanagerconfig redisconfig = new Redisclientmanagerconfig ();    Redisconfig.autostart = true;    Redisconfig.maxreadpoolsize =;    Redisconfig.maxwritepoolsize =;    Pooledredisclientmanager PRCM = new Pooledredisclientmanager (new list<string> () {"127.0.0.1"}, New list< String> () {"127.0.0.1"}, Redisconfig);    using (iredisclient rclient = prcm. Getclient ())    {        rclient.add ("P", "Shake Sacred Ox");    using (iredisclient rclient = prcm. Getclient ())    {        Response.Write (rclient.get<string> ("P"));    }    Return Content ("");}

For more information on Redis operations, it is recommended to watch the red pill "Redis combat" and this nice URL: http://redis.readthedocs.org/en/latest/.

Essay Classification-performance: Cache cache Learning Notes Servicestack.redis Common operations-transactions, Concurrency Lock Summary: One, transactions using Iredisclient Execution Transaction example: using (iredisclient rclient = prcm. Getclient ()) {Rclient.add ("key", 1), using (iredistransaction IRT = rclient.createtransaction ()) {IRT. Queuecommand (r = R.set ("key", 20)); Irt. Queuecommand (r = r.increment ("key", 1)); ... Read the full posted @ 2014-03-18 18:57 Inverse mind Reading (1198) | Comments (4) Edit
Servicestack.redis iredistypedclient< Fourth > Abstract: Iredistypedclient iredistypedclient class is equivalent to the strong type version of Iredicclient, Most of its methods and properties are similar to Iredisclient. It supports the powerful class that uses LINQ queries in Redis, which itself is a generic, iredisclient generic method as a Get object. The prototype method is as follows: Iredistypedclient as (); 1, Ientitystore interface content wherein iredistypedclient This class implements this interface Ientitystore, The interface requires the following features: Method Description Delete Deletes a record based on entity DeleteAll all delete Deletebyid root ... Read the full posted @ 2014-03-17 19:58 Inverse mind reading (801) | Comments (1) Edit
Redis Common Commands Quick Check < second > summary: First, key key command quick check: command Description del Delete given one or more keys, the nonexistent key will be ignored, return value: The number of deleted keys dump serializes the given key, returns the serialized value, using the The RESTORE command can deserialize this value into a Redis key exists check if a given key exists expire set a valid time for a given key, accept a point in time expireat set a valid time for a given key, Accept the timestamp Timestampkeys find all Key;keys h?llo matching Hello,hallo in the Key;keys * matching database that match the pattern of the given patterns. The KEYS H[ae]llo matches hello and hallomigr. Read the full text posted @ 2014-03-13 17:36 Inverse mind Reading (4561) | Comments (0) Edit
Servicestack.redis iredisclient< Third > Abstract: In fact, many of the methods inside Iredisclient are actually the name of the Redis command. As long as you are familiar with Redis commands, you can understand these methods very quickly, and while you are not particularly knowledgeable about Redis, I am also looking at these methods with commands. Attribute iredisclient attributes are as follows: Property Description ConnectTimeout Connection Timeout DB current database ID or subscript dbsize the number of keys in the current database Hadexceptionshashes store complex objects, A value that has several Fieldhostredis server host address info returns information about the Redis server and statistical values lastsave the most recent Redis success ... Read the full posted @ 2014-02-27 17:52 Inverse mind reading (3030) | Comments (5) Edit
Redis installation and simple example < First > summary: one, Redis installation Redis as follows: Https://github.com/dmajkic/redis/downloads after decompression according to the actual situation of their own machine to choose 32 or 64 bits. Download the extracted image as follows: Redis-server.exe Redis server daemon launcher redis.conf redis configuration file redis-cli.exe Redis command line action tool. Of course, you can also use Telnet according to its plain text protocol to operate the Redis-check-dump.exe Local database check redis-check-aof.exe update log check Redis-benchmark.exe performance test to simulate simultaneous n ... Read the full posted @ 2014-02-27 10:52 Inverse mind Reading (1071) | Comments (0) Edit
Memcached (first) Summary: Memcached is a "distributed" Memory object caching system, so there is no need to "distribute", do not need to share or simply small to a single server application, Memcached will not bring any benefits, but also slow down the system efficiency, Because the network connection also needs resources, if it is a local level cache, using memcached is very uneconomical. Memcached is often used as a database front-end cache. Because it is much less expensive than a database for SQL parsing, disk operations, and it uses memory to manage data, it can provide better performance than reading a database directly. In large systems, access to the same data is very frequent, memcached can greatly reduce the database pressure, so that the system execution efficiency. In addition, memcached is often used as a server ... Read the full posted @ 2014-02-14 14:06 Inverse Mind Reading (125) | Comments (0) Edit
Cache Overview Summary: There are two types of caches: the client cache client cache is actually a browser thing, and when we go to a new website, it may take a while for the first time to load the entire page. However, the later time will be greatly shortened, the reason is the client cache. Now the browser is very intelligent, it will be on the client machine's hard disk to retain a lot of static files, such as various gif,jpeg and so on. When you go later, it will try to use the files in the local cache, only the server-side files are updated, or the cache files expire, it will be downloaded from the server side of these things again. Many times browsers do this for us. Second, the server cache some things have no way or is not appropriate in the client cache, this time must be on the server side to find out. Server-side cache from the nature of view, can be divided into two kinds ... Read the full posted @ 2013-05-23 14:20 Inverse Mind Reading (141) | Comments (0) Edit
The System.Web.Caching.Cache class caches various cache dependency summaries: the cache class, which is a class for caching commonly used information. Httpruntime.cache and HttpContext.Current.Cache are examples of this class. The Attribute property Description count Gets the number of items stored in the cache. Effectivepercentagephysicalmemorylimit gets the percentage of physical memory that an application can use before ASP. NET begins to remove items from the cache. Effectiveprivatebyteslimit Gets the number of bytes available for caching. Item Gets or sets the cache entry at the specified key. Ii. Method Name Description Add adds the specified item to the cache object that has a dependency, expiration, and priority policy, and a delegate that can be used to move from the cache: Read the full posted @ 2013-05-07 15:43 Inverse mind Reading (4497) | Comments (6) Edit

Redis installation and Simple example

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.