<redis in action>5.3 ip-to-city and-country Lookup

Source: Internet
Author: User

Original: https://redislabs.com/ebook/redis-in-action/part-2-core-concepts-2/ Chapter-5-using-redis-for-application-support/5-3-ip-to-city-and-country-lookup

When we have collected statistical information and logs to Redis, we have collected information about the behavior of our system visitors. But we overlook an important part of visitor behavior-where do visitors come from? In this section we will build a set of functions to parse IP into the region database, and we will write a function to query the IP address used to determine the visitor's city, region, country. Let me see an example.

When fake game company visitors multiply, players have come from all over the world. While tools like Google Analytics have helped companies know the main countries where users come from, they want to know the cities and regions to better understand the users. This is what we do, using a data that resolves to the city with a IP address combined with Redis to find the user location.

We use Redis instead of the traditional relational database, because Redis will be faster in this case. We use Redis to find tables locally because a large number of user information lookups make it a relatively expensive operation to load the table when the app is launched. To get started with our lookup table, you first need to load the table to Redis.

Fake

<redis in action>5.3 ip-to-city and-country Lookup

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.