WO2017020765A1 - 基于位置信息获取数据的方法和装置 - Google Patents

基于位置信息获取数据的方法和装置 Download PDF

Info

Publication number
WO2017020765A1
WO2017020765A1 PCT/CN2016/091947 CN2016091947W WO2017020765A1 WO 2017020765 A1 WO2017020765 A1 WO 2017020765A1 CN 2016091947 W CN2016091947 W CN 2016091947W WO 2017020765 A1 WO2017020765 A1 WO 2017020765A1
Authority
WO
WIPO (PCT)
Prior art keywords
area
hotspot data
range
user terminal
data
Prior art date
Application number
PCT/CN2016/091947
Other languages
English (en)
French (fr)
Inventor
魏仁亮
林海林
卓晓光
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to US15/571,082 priority Critical patent/US11144609B2/en
Publication of WO2017020765A1 publication Critical patent/WO2017020765A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases

Definitions

  • the embodiments of the present application relate to the field of data processing, and in particular, to a method and apparatus for acquiring data based on location information.
  • LBS Location Based Service
  • GSM Global System for Mobile communications
  • GIS Geographic Information System
  • LBS includes two meanings: first, to determine the geographic location of the mobile device or user; secondly, to provide various types of information services related to the geographic location. For example, find the current geographic location of the mobile phone user (such as located in Beijing), and then find the name and address of the hotel, theater, library, gas station, etc. within 1 km of the current location of the mobile phone user within the scope of Beijing. And other information.
  • the mobile terminal or the latitude and longitude information of the user may be used to search for the mobile terminal or the business information in the vicinity of the user (for example, the name and address of the restaurant, supermarket, hospital, hotel, theater, library, gas station, etc.) information).
  • the geographical segment of the coverage is segmented according to a fixed range (for example, the geographic plate corresponding to Beijing is divided into a plurality of squares having a side length of 1 km), and a plurality of segmented sections are obtained, and Every post-cut version All listings contained in the block are cached as business data to the backend server.
  • a user in a certain section sends location information (for example, latitude and longitude information of the user) to the background server to request nearby business information (such as restaurant information within a range of 1 km from the current location of the user), the hit is determined according to the latitude and longitude information of the user. Which section is used, and then directly obtains the business data corresponding to the section saved in the cache.
  • location information for example, latitude and longitude information of the user
  • business information such as restaurant information within a range of 1 km from the current location of the user
  • the embodiment of the present application provides a method and an apparatus for acquiring data based on location information, so as to at least solve the problem that in the prior art, when searching for nearby merchant information according to latitude and longitude, all the merchant information needs to be cached in the background server, resulting in a large occupation.
  • Technical issues with storage space are provided.
  • a data acquisition based on location information includes: receiving a query request for acquiring object information sent by a user terminal, where the query request carries location information of the user terminal; and if the buffer area is not empty, querying location information of the user terminal from the buffer area.
  • the hotspot data in the area where the hotspot data is the information of the object included in the cached area when the frequency of the query access in the area exceeds a predetermined threshold; the hotspot data in the obtained area is sent. To the user terminal.
  • an apparatus for acquiring data based on location information including: a receiving unit, configured to receive a query request sent by a user terminal for acquiring object information, where the query request is carried in The location information of the user terminal is used to query the hotspot data in the area where the location information of the user terminal is located from the buffer area when the buffer area is not empty, wherein the hotspot data is generated within the area The information of the object included in the cached area when the frequency of the query exceeds the predetermined threshold; the sending unit is configured to send the hotspot data in the obtained area to the user terminal.
  • the query request for acquiring the object information sent by the user terminal is received, where the query request carries the location information of the user terminal; if the buffer area is not empty, the user terminal is queried from the buffer area.
  • the hotspot data in the area where the location information is located, where the hotspot data is the information of the object included in the cached area when the frequency of the query access occurs in the area exceeds a predetermined threshold; the hotspot within the obtained area The data is sent to the user terminal, which solves the problem that in the prior art, when searching for nearby business information according to latitude and longitude, all the business information needs to be cached in the background server, which leads to technical problems of occupying a large storage space, and reduces the occupation background. The effect of the server's storage space.
  • FIG. 1 is a flowchart of a method for acquiring data based on location information according to Embodiment 1 of the present application;
  • FIG. 2 is a flowchart of an optional method for acquiring data based on location information according to Embodiment 1 of the present application;
  • FIG. 3 is a flowchart of another optional method for acquiring data based on location information according to Embodiment 1 of the present application;
  • FIG. 4 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application;
  • FIG. 5 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application;
  • FIG. 6 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application;
  • FIG. 7 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application.
  • FIG. 8 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application.
  • FIG. 9 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application.
  • FIG. 10 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application;
  • FIG. 11 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application;
  • FIG. 12 is a schematic structural diagram of an apparatus for acquiring data based on location information according to Embodiment 2 of the present application;
  • FIG. 13 is a structural block diagram of a computer terminal according to an embodiment of the present application.
  • GeoHash algorithm Converts two-dimensional latitude and longitude information into a sortable and comparable string encoding.
  • the GeoHash algorithm has the following characteristics: First, the GeoHash algorithm uses a string encoding to represent the longitude and latitude coordinates; secondly, the string encoding obtained by the GeoHash algorithm represents not a point but a rectangular area; The prefix of the string encoding can represent a larger area, and this feature can be used for searching in nearby locations.
  • a method for acquiring data based on location information is provided. As shown in FIG. 1, the method may include the following steps:
  • Step S10 Receive a query request sent by the user terminal for acquiring object information.
  • the query request carries the location information of the user terminal.
  • the query request sent by the user terminal for acquiring the object information may be received by the background server.
  • the user terminal may be a personal computer or a mobile terminal, such as a smart phone, a notebook, a tablet, or the like.
  • the object may be a merchant in the vicinity of the user terminal, and the object information may include any one or more of the following data: a distance from the user terminal (eg, less than 500 meters), and a geographical area information of the merchant (eg, XX City XX District), the street information of the merchant, the latitude and longitude information of the merchant, the name of the store's store, and whether the merchant has preferential activities.
  • the merchants in the above embodiments may be restaurants, cinemas, hotels, KTVs, tourist attractions, and the like.
  • the location information of the user terminal may include at least one of the following information: latitude and longitude information, street information, geographical area information, attribution of business circle information, and the like.
  • the user terminal before the background server receives the query request sent by the user terminal, the user terminal needs to generate a corresponding query request.
  • the query request can be generated by an application installed on the user terminal.
  • the user holding the user terminal needs to obtain the object information (for example, the user needs to obtain the hotel information in the vicinity thereof)
  • the user can generate a query request carrying the location information of the user terminal through the user terminal, and then the user terminal queries the query.
  • the request is sent to the background server, and the background server receives the query request sent by the user terminal for acquiring the object information.
  • the above query request may be generated by an application installed on the user terminal.
  • the above embodiment of the embodiment of the present application is described by taking an application scenario in which the user terminal is a smart phone and the application installed on the user terminal is an application scenario of the mobile phone QQ application.
  • the user of the smartphone wants to obtain the hotel information in the vicinity, the user can click on the mobile phone QQ.
  • the mobile QQ application After entering the interface of "Eating, Drinking and Playing” option, select “Gourmet" in the upper left corner, then the mobile QQ application will Send a query request to the background server according to the options selected by the user and the location information of the mobile phone (such as the specific location of the user).
  • the above embodiment of the present application will be described by taking the user terminal as the smart phone and the application program installed on the user terminal as the application scenario of the mobile phone WeChat.
  • the user of the smartphone wants to obtain the restaurant information in the vicinity, the user can click on “I” in the mobile phone WeChat interface, and further select the “eat, drink and play” option in “I”, and enter “eat, drink and play”.
  • select “Gourmet” in the upper left corner After the interface of the option, select “Gourmet” in the upper left corner.
  • the mobile phone WeChat will send a query request to the background server according to the option selected by the user and the location information of the mobile phone (such as the specific location where the user is located).
  • Step S13 In the case that the buffer area is not empty, query the hotspot data in the area of the area where the location information of the user terminal is located from the buffer area.
  • the hotspot data is information of an object included in the cached area when the frequency of the query access occurs in the area exceeds a predetermined threshold.
  • step S13 of the embodiment of the present application after receiving the query request sent by the user terminal, when the buffer area of the background server is not empty, the background server queries the hot spot data in the area of the location where the location information is located from the buffer area.
  • the area range may be a range covering a preset geographic section
  • the area-wide hotspot data may include object information of all merchants within its coverage.
  • the hotspot data is triggered by the user.
  • the hit rate of the business information in the area stored in the cache area is higher.
  • the area is considered to be hot data.
  • a predetermined threshold that is, when the number of user terminals performing the query operation in the area is large, that is, when there are more users gathering in the area.
  • the area is determined as a hotspot area, and object information of all objects included in the hotspot area is cached as hotspot data in the area range (ie, the hotspot area).
  • the predetermined threshold may be set according to actual application requirements, which is not specifically limited in this embodiment of the present application.
  • querying the hotspot data in the area of the area where the location information of the user terminal is located from the buffer area may include the steps shown in FIG. 2:
  • step S131 the area of the area where the location information of the user terminal is located is queried from the buffer area.
  • the buffer area caches at least one preset area range and hotspot data in the area range.
  • the background server After receiving the query request sent by the user terminal, the background server detects whether the buffer area is non-empty; when detecting that the buffer area of the background server is not empty, querying the user terminal according to the location information of the user terminal The scope of the area.
  • the above embodiment of the present application will be described by taking an application scenario in which the user terminal is a smart phone and an application installed on the user terminal for the mobile phone QQ application as an example.
  • the mobile QQ application sends a query request carrying location information (such as latitude and longitude information) of the current location of the mobile phone to the background server
  • the background server detects whether the buffer is non-empty, and when detecting that the buffer is not empty, According to the latitude and longitude information of the user, the area of the area to which the current location of the mobile phone belongs belongs is queried from the buffer area.
  • At least one preset area range and hotspot data in the area are cached in the buffer area of the background server, where the area range has an association relationship with the hotspot data in the area.
  • the hotspot data within it can be read.
  • step S133 if the query is successful, the hotspot data in the area range is read from the buffer area.
  • the hotspot data in the area is read from the buffer area.
  • the above embodiment of the present application will be described by taking an application scenario in which the user terminal is a smart phone and an application installed on the user terminal for the mobile phone QQ application as an example.
  • the mobile QQ application sends a query request carrying location information (such as latitude and longitude information) of the current location of the mobile phone to the background server
  • the background server detects whether the buffer is non-empty, and when detecting that the buffer is not empty, According to the latitude and longitude information of the user, the area of the area to which the current location of the mobile phone belongs belongs is queried from the buffer area.
  • Step S135 In the case that the query fails, the hotspot data in the area of the location where the location information of the user terminal is located is obtained by accessing the third-party server, and the area range and the corresponding hotspot data are cached into the buffer area.
  • the background server needs to forward the query request sent by the user terminal to a third-party server (such as a server of an external partner merchant).
  • a third-party server such as a server of an external partner merchant.
  • the hotspot data in the area of the area where the location information of the user terminal is located is obtained by accessing the third server, and the obtained hotspot data in the area is associated with the area range and then cached in the buffer area of the background server.
  • the hotspot data in the area where the location information of the user terminal is located is obtained by accessing the third-party server, and the area range and the corresponding hotspot data are cached in the buffer area, if the data is received again, In the process of performing the step S13, the step S13 to S15 are performed, and the hotspot data in the area is not required to be accessed again by accessing the third-party server. The hotspot data in the area is read from the cache area, thereby reducing the processing pressure of the third-party server.
  • obtaining hotspot data in the area of the location where the location information of the user terminal is located by accessing the third-party server may be implemented by forwarding the query request to an interface of the third-party server (such as a merchant interface of the external cooperative merchant), because the external cooperative merchant Processing capability of the merchant interface Therefore, the above embodiments of the present application can greatly alleviate the pressure of the merchant interface, that is, reduce the processing pressure of the third-party server.
  • an interface of the third-party server such as a merchant interface of the external cooperative merchant
  • the obtained hotspot data may be directly returned to the user terminal by the third-party server, and the hotspot data is returned to the background server for the background server.
  • the hotspot data and the corresponding area range are cached in the buffer area, and the hotspot data may be returned to the user terminal by the background server after the background server completes the cache.
  • the above embodiment of the present application will be described by taking the above-mentioned application scenario in which the user terminal is a smart phone and the application installed on the user terminal is a mobile QQ application, and the third-party server is used as a server of the public comment network.
  • the background server detects whether the buffer is non-empty, and detects that the buffer is not empty. Then, according to the latitude and longitude information of the user, the area of the area to which the current location of the mobile phone belongs belongs is queried from the buffer area.
  • location information such as latitude and longitude information
  • the query request of the user is forwarded to the server of the public comment network for processing, and the server of the public comment network is based on the current location of the mobile phone.
  • the corresponding hotspot data is not required to be obtained by the third-party server again, and the hotspot data can be directly read from the buffer area, thereby reducing the hotspot data.
  • the processing pressure of third-party servers is not required to be obtained by the third-party server again, and the hotspot data can be directly read from the buffer area, thereby reducing the hotspot data.
  • step S15 the hotspot data in the obtained area range is sent to the user terminal.
  • the hotspot data in the area where the location information of the user terminal is located is obtained, the hotspot data is returned to the user terminal.
  • the above embodiment of the present application will be described by taking an application scenario in which the user terminal is a smart phone and an application installed on the user terminal for the mobile phone QQ application as an example.
  • the mobile QQ application sends a query request carrying location information (such as latitude and longitude information) of the current location of the mobile phone to the background server
  • the background server detects whether the buffer is non-empty, and when detecting that the buffer is not empty, According to the latitude and longitude information of the user, the area of the area to which the current location of the mobile phone belongs belongs is queried from the buffer area.
  • All the hotel information (such as the name of the hotel and the current location of the mobile phone) in the area to which the current location of the mobile phone belongs (for example, 500 meters near the Zhichun Road subway in Haidian District, Beijing) is obtained through the buffer area or through a third-party server. After the distance, whether there are special promotions and the specific location of the hotel, etc.), the background server returns all the obtained hotel information to the mobile QQ application, and the mobile QQ application displays the received hotspot data in the display interface for the user. View.
  • the hot spot data in the area where the location information is located is queried from the buffer area according to the location information of the user terminal carried in the query request, and the data is sent to the user terminal.
  • hotspot data such as merchant information
  • the merchant information of the remote location is not cached, and the geographical coverage of the national coverage is not required to be segmented according to a fixed range in the prior art and cached in each section after the division.
  • All business information that is, without having to store all the business information in each section of the country, reduces the required storage space and reduces the storage pressure of the background server.
  • the prior art needs to cache all the merchant information in the background server when searching for the nearby merchant information according to the latitude and longitude, thereby causing technical problems of occupying a large storage space, and reducing the occupation background.
  • the storage space of the server reduces the storage pressure of the background server.
  • step S135 the cache area range and the corresponding hotspot Data to the buffer can include:
  • step S1351 the two-dimensional latitude and longitude data for indicating the area range is converted into a one-dimensional first character string code.
  • the background server converts the two-dimensional latitude and longitude data for indicating the range of the area into a one-dimensional first string code.
  • the two-dimensional latitude and longitude data can be converted into a sortable and comparable one-dimensional string encoding by the GeoHash algorithm, and each string encoding represents a certain range of regions.
  • each string encoding represents a certain range of regions.
  • the accuracy of the range of the range indicated by the GeoHash string is higher.
  • the length of the GeoHash string encoding is 8
  • the accuracy of the range of the range represented by the GeoHash is about 19 meters
  • the GeoHash character is
  • the length of the string code is 9
  • the accuracy of the range of the range indicated by the string is about 2 meters, and the length of the string encoding needs to be selected according to the data.
  • step S1353 the first character string is encoded and the hotspot data in the acquired region is associated with the cached data.
  • the background server converts the two-dimensional latitude and longitude data for indicating the range of the region into the one-dimensional first string encoding
  • the first string encoding and the obtained hotspot data in the region range are associated, , and then cached to the cache of the background server.
  • the above embodiment of the present application will be described by taking an example of converting a two-dimensional latitude and longitude data into a one-dimensional string encoding by the GeoHash algorithm.
  • the geographic extent covered by Beijing is pre-divided into nine regional ranges (such as rectangular regions), and the first string encoding (such as the GeoHash string) of each rectangular region is WX4ER, WX4G2, WX4G3, etc., each of which The GeoHash string represents a rectangular area. That is to say, all the points in this rectangular area (the position of each point in latitude and longitude coordinates) share the same GeoHash string, which can protect privacy (only means approximate area location instead of specific point), and it is easier Do the caching.
  • WX4ER For example, users in the rectangular area of WX4ER keep sending The location information is sent to the background server for the restaurant information in the vicinity (ie, the hotspot data mentioned above). Since the GeoHash string of all users in the rectangular area of the WX4ER is WX4ER, the WX4ER can be regarded as a key, and the rectangular area can be Hot data is cached as value, and if GeoHash is not used, it is difficult to cache because the latitude and longitude data sent by users in the same rectangular area are different.
  • the length of the first character string encoding can be conveniently adjusted according to the frequency of the query access occurring in the region.
  • the area range represented by the first character string encoding can also conveniently adjust the geographical range covered by the area range, and solves the problem that the prior art divides the board according to the fixed range, and when the size of the section is updated, the update operation. The cumbersome and low-efficiency problem enables a convenient and fast dynamic adjustment of the size of the area.
  • the area range in which the location information of the user terminal is located from the buffer area may include:
  • Step S1311 Convert the latitude and longitude data in the location information of the user terminal into a second character string code recognizable by the buffer area.
  • the latitude and longitude data in the location information of the user terminal carried in the received query request is converted into a second character string code recognizable by the buffer.
  • the above embodiment of the present application will be described by taking an example of converting a two-dimensional latitude and longitude data into a one-dimensional string encoding by the GeoHash algorithm.
  • the latitude and longitude data of the user terminal is converted into a one-dimensional GeoHash string by the GeoHash algorithm.
  • step S1313 it is queried in the buffer area whether or not the first character string encoding identical to the second character string encoding is stored.
  • step S1315 is performed; in the case where the first character string encoding identical to the second character string encoding is not stored in the buffer area, step S1317 is performed.
  • the latitude and longitude data of the user terminal is converted by the GeoHash algorithm to a GeoHash character string (ie, the second string code described above) and used to represent the area.
  • the latitude and longitude data of the range is the same as the GeoHash string converted by the GeoHash algorithm (ie, the first string encoding described above). If the first string encoding the same as the second string encoding is queried in the buffer area, the buffer area is indicated. The hotspot data of the area is stored in the area.
  • step S1315 it is determined that the area range is successfully queried.
  • the hotspot data in the area is read from the buffer area, and the implementation manner of the step S1315 is consistent with the implementation manner of step S133 in the foregoing embodiment, and is no longer Narration.
  • step S1317 it is determined that the query area range fails.
  • the hotspot data in the area of the location where the location information of the user terminal is located is obtained by accessing the third-party server, and the area range and the corresponding hotspot data are cached in the buffer area, and the step S1317 is performed.
  • the implementation manner is the same as the implementation manner of step S135 in the foregoing embodiment, and details are not described herein again.
  • the above embodiment of the present application will be described below by taking the above-mentioned application scenario in which the user terminal is a smart phone and the application installed on the user terminal is the application scenario of the mobile phone QQ application, and the third-party server is used as the server of the public comment network.
  • the background server detects the cache. Whether the area is non-empty, in the case that the buffer area is detected to be non-empty, the GeoHash algorithm is used to convert the user's latitude and longitude information into a one-dimensional second string code, and the buffer is queried whether the second string is stored. Encode the same first string encoding (used to represent the range-wide string encoding).
  • the range of the query area is determined to be successful, that is, the area of the area where the current location of the mobile phone belongs is stored in the buffer area. (such as 500 meters near the Zhichun Road subway in Haidian District, Beijing), then read all the hotel information within 500 meters from the Zhichun Road subway in Haidian District, Beijing, and return to the mobile QQ application for users to view. .
  • the background server forwards the user's query request to the server of the public comment network for processing, and the server of the public comment network determines the area of the area according to the current location of the mobile phone (such as Beijing 500 meters near the Zhichun Road subway in Haidian District, and return all the hotel information in the area (such as the name of the hotel, the distance from the current location of the mobile phone, whether there are special promotions and the specific location of the hotel, etc.) to the back-end server.
  • the current location of the mobile phone such as Beijing 500 meters near the Zhichun Road subway in Haidian District
  • the background server converts the corresponding area range (such as 500 meters near the Zhichun Road subway in Haidian District, Beijing) into a one-dimensional first string code by the GeoHash algorithm, and returns the first string code to the server of the public comment network.
  • the hotspot data is cached and cached in the cache.
  • the hotspot data may be returned to the mobile QQ application by the server of the public comment network for viewing by the user, or the background server may cache the hot data of the first string encoded and returned to the buffer area. After that, the hotspot data is returned to the mobile QQ application.
  • the location information of the user terminal when the location information of the user terminal is queried according to the location of the user terminal, only the latitude and longitude data of the location of the user terminal needs to be converted into a one-dimensional GeoHash character string, and the GeoHash of each area range stored in the buffer area is String prefix prefix
  • the GeoHash string of the area is the same as the GeoHash string of the location of the user terminal
  • the area of the area where the user terminal is located in the buffer area can be determined, and the query is convenient and efficient, and the query efficiency is high.
  • the method may further include: setting a preset for the hotspot data, while the cached to the cache area is associated with the hotspot data in the area where the first character string is encoded and acquired.
  • the expiration time wherein the expiration time is determined according to the frequency at which the hotspot data is queried; when the time when the hotspot data is stored in the buffer reaches the expiration time, the hotspot data is deleted from the cache.
  • a preset expiration time is set for the hotspot data, and When the time when the hotspot data is stored in the buffer reaches the expiration time, the hotspot data is deleted from the cache to achieve the effect of updating the hotspot data in time.
  • the background server receives the query request for acquiring the object information in the area again, it needs to return.
  • the above steps S10 to S15 are performed.
  • the length of the expiration time is related to the processing pressure of the third-party server. If the expiration time is short, the third-party server needs to process the query request of the user terminal multiple times, and the processing capability of the third-party server becomes the bottleneck of the entire system. The query efficiency cannot process the query request sent by the user terminal in time, resulting in long waiting time and poor user experience. If the expiration time is too long, the business information in the area may not be updated in time.
  • the expiration time may be determined according to the frequency at which the hotspot data is queried, that is, according to the hit rate of the hotspot data.
  • the cache area stores hotspot data in the area, and is called Hit the hotspot data, the more times you hit the hotspot data, It means that the hit rate of the hotspot data is higher.
  • the hotspot data in the area is set to a long expiration time, such as 1 day or 2 days, to avoid hot data in the area being repeatedly updated in a short time, resulting in high processing pressure of the background server and the third party server.
  • setting an expiration time for the hotspot data can ensure that the merchant information in the corresponding area is updated in time and effectively, so as to provide the user with the latest business information, such as when adding a new merchant or adding a merchant offer, Provide relevant information to users in a timely manner.
  • the above embodiment of the present application will be described below by taking the above-mentioned application scenario in which the user terminal is a smart phone and the application installed on the user terminal is the application scenario of the mobile phone QQ application, and the third-party server is used as the server of the public comment network.
  • the user's query request is forwarded to the server of the public comment network for processing, and the server of the public comment network determines the area to which the mobile phone belongs according to the current location of the mobile phone (for example, 500 meters near the Zhichun Road subway in Haidian District, Beijing), and After returning all the hotel information in the area to the background server, the server will convert the corresponding area range (such as 500 meters near the Zhichun Road subway in Haidian District, Beijing) into a one-dimensional first string code by the GeoHash algorithm.
  • the background server sets the expiration time corresponding to the hot spot data, and the expiration time can be based on the hot spot.
  • the hit rate of the data is dynamically adjusted, that is, when the hit rate of the hotspot data is high, that is, when there are more users in the corresponding area, when the query operation is performed, the expiration time can be extended to alleviate the repeated update of the background server.
  • the foregoing method may further include: monitoring, querying the same from the buffer area.
  • the third party server After receiving the query request for obtaining the object information in the adjusted region, the third party server obtains the hotspot data in the adjusted region, and caches the adjusted region range and corresponding Hotspot data into the cache.
  • the number of queries that query the same area range from the buffer area is monitored, that is, the hit rate of each hotspot data in the buffer area is monitored, and when the number of queries that query the same area range from the buffer area is monitored, the number of queries exceeds
  • the query threshold is preset, it indicates that there are more users in the area to perform the query operation. If there are more users querying the object information at the outer edge of the area, the users at the outer edge will not It will hit the hotspot data in the area. At this time, the processing pressure of the third-party server may be too large, and the query request sent by the user terminal cannot be processed in time. The user waits for a long time and the user experience is poor. Therefore, the monitoring is performed.
  • the precision of the first string encoding may be shortened by shortening the length of the first string encoding, thereby expanding the coverage of the range of the queried region.
  • the adjusted area range can cover a larger geographical range.
  • the adjusted region range after receiving the query request for acquiring the object information in the adjusted region, obtaining the adjusted region-wide hotspot data by accessing the third-party server, and The adjusted area range and the corresponding hotspot data are cached in the buffer area.
  • the specific implementation of the step is the same as the implementation of the step S135 in the foregoing embodiment, and details are not described herein again.
  • the hotspot data in the adjusted area is obtained by accessing the third-party server, and the adjusted area range and the corresponding hotspot data are associated and cached in the buffer area, if Receiving the query request for acquiring the object information in the adjusted area, and returning to the step S13 to S15, in the process of performing the step S13, it is not necessary to acquire the area within the area by accessing the third party server again.
  • Hot data The hotspot data in the area can be read directly from the buffer area, thereby reducing the processing pressure of the third party server.
  • obtaining the hotspot data in the adjusted area by accessing the third-party server may be implemented by forwarding the query request to an interface of the third-party server (such as the merchant interface of the external partner), because the merchant interface of the external partner merchant
  • the above embodiments of the present application can greatly alleviate the pressure on the merchant interface and reduce the processing pressure of the third-party server.
  • the above embodiment of the present application will be described below by taking the above-mentioned application scenario in which the user terminal is a smart phone and the application installed on the user terminal is the application scenario of the mobile phone QQ application, and the third-party server is used as the server of the public comment network.
  • the background server monitors the number of queries from the cache area to the same area (such as 300 meters near Tiananmen Square in Beijing), the number of queries exceeds the preset query threshold, indicating that more users within 300 meters near Tiananmen Square in Beijing are passing their mobile QQ.
  • the application performs the inquiry operation of the hotel information.
  • the users within 300 meters to 1500 meters near Tiananmen Square in Beijing have more inquiries about the operation of nearby hotel information through their mobile phones, and the users within 300 meters to 1500 meters near Tiananmen Square in Beijing.
  • the query operation cannot hit the hotspot data (such as hotel information) within 300 meters near Tiananmen Square in Beijing.
  • the server of the public comment network may be required to process the query request of this part of the user. Due to the limited processing capacity of the server of the public comment network, Only a limited number (such as 1000) of query requests can be processed, which will cause some users to wait for a long time, resulting in poor user experience.
  • the code length used to represent the GeoHash string within 300 meters of Tiananmen Square in Beijing can be reduced, as reduced by a 6-bit code (representing a range of about 0.34 square kilometers) to a 5-digit code (representing 10 square kilometers).
  • Meter range which can represent the area within 1500 meters near Tiananmen Square in Beijing.
  • the server processes the server, and the server of the public comment network determines the area of the mobile phone according to the current location of the mobile phone (such as within 1500 meters near Tiananmen Square in Beijing), and all the hotel information in the area (such as the name of the hotel, the current mobile phone) The distance from the location, whether there are special offers, and the specific location of the hotel, etc.)
  • the background server caches the hotspot data returned by the server of the public comment network and the corresponding area range (such as within 1500 meters near Tiananmen Square in Beijing) and caches it in the buffer area.
  • the corresponding hotspot data is not required to be obtained through the server of the public comment network again (for example, Hotel information), but can directly read the hotspot data from the buffer area, reducing the processing pressure of the server of the public comment network.
  • the foregoing method may further include: monitoring the access volume of the third-party server; When the number of visits exceeds the preset access threshold, the expiration time of the hotspot data is extended according to the amount of access.
  • the processing capability of the third-party server is limited, and the system processing bottleneck is caused in order to avoid the processing capability of the third-party server.
  • you need to monitor the access volume of the third-party server that is, monitor the number of query requests processed by the third-party server.
  • the number of accesses monitored by the third-party server exceeds the preset access threshold, It can be considered that the processing capability of the third-party server has reached the limit, and other query requests cannot be processed in time.
  • the expiration time of the corresponding hot-spot data can be extended according to the amount of the access, and the hot-spot data can be avoided. Repeat updates in a short period of time while reducing the processing pressure on third-party servers.
  • the above embodiment of the present application will be described by taking the above-mentioned application scenario in which the user terminal is a smart phone and the application installed on the user terminal is a mobile QQ application, and the third-party server is used as a server of the public comment network.
  • the hotspot data such as hotel information
  • the server of the public comment network such as 500 meters near the Zhichun Road subway in Haidian District, Beijing
  • the background server monitors the forwarding to the public comment network
  • the number of query requests of the server exceeds the preset access threshold, indicating that the processing capacity of the server of the public comment network has reached its upper limit.
  • the subsequent query request will be temporarily suspended. Unable to process, which in turn causes some users to wait For a long time, the user experience is reduced. At this time, the expiration time of the corresponding hotel information within 500 meters near the Zhichun Road subway in Haidian District, Beijing can be extended to extend the storage time in the buffer area, thereby reducing the update frequency of hotspot data, when a user requests to obtain Beijing.
  • the hotel information within 500 meters near the subway of Zhichun Road in Haidian District you do not need to forward the request to the server of the public comment network, but directly read the corresponding hotel information from the buffer area of the background server to reduce the server of the public comment network. Handling the pressure of individual user requests, and also reducing the processing pressure of the background server to repeatedly update hotspot data within the area.
  • the method may further include: obtaining, by accessing a third-party server, hotspot data in an area where the location information of the user terminal is located, and buffering the area range and the corresponding area. Hotspot data into the cache; set expiration time for hotspot data.
  • the background server after receiving the query request of the user acquiring the object information sent by the user terminal, if the background server detects that the buffer area is empty (such as when the system first starts running or the hotspot data cached in the background server is all expired and the query request is After the query operation is performed, the background server forwards the query request to the third-party server to obtain the hotspot data in the corresponding area by accessing the third-party server, and after obtaining the hot data returned by the third-party server, The background server associates the area range and the corresponding hotspot data into the buffer area, and sets an expiration time for the hotspot data.
  • the implementation manner of the step is the implementation manner of the step S135 in the foregoing embodiment of the present application, and the step “setting a preset expiration time for the hotspot data; when the hotspot data is stored in the buffer area reaches the expiration time, the hotspot is The implementation of deleting data from the cache area is consistent, and will not be described here.
  • the foregoing method may further include: acquiring an object in the area of the location where the location information of the user terminal is located by accessing the third-party server. Information, and cache the area range and corresponding object information into the buffer area; set an expiration time for the object information, wherein the expiration time of the object information is less than the expiration time of the hot item data.
  • the background server forwards the query request to the third-party server, and obtains the corresponding object information by accessing the third-party server, so as to avoid other user terminals querying in the short-term.
  • the object information in the area the background server caches the obtained object information and the corresponding area range into its buffer area, and sets a short expiration time for the object information, so as to avoid using the cached data for a long time to occupy the background server. Storage space.
  • the above embodiment of the present application will be described by taking the above-mentioned application scenario in which the user terminal is a smart phone and the application installed on the user terminal is a mobile QQ application, and the third-party server is used as a server of the public comment network.
  • the mobile QQ application When the user is located in a remote town, if there are not many users in the town, when a user needs to obtain the information of the nearby hotel, the mobile QQ application will carry the location information of the current location of the mobile phone (such as The query request of the latitude and longitude information is sent to the background server.
  • the background server After the background server does not query the area range of the current location of the mobile phone from the cache area, the query request of the user is forwarded to the server of the public comment network for processing, and the public comment
  • the server of the network determines the area of the area to which the mobile phone belongs according to the current location of the mobile phone, and all the hotel information in the area (such as the name of the hotel, the distance from the current location of the mobile phone, whether there is a preferential event, and the specific location of the hotel, etc.)
  • the background server associates the object information returned by the server of the public comment network with the corresponding area range (such as 500 meters near the XX street of XX Town, XX City) and caches it in the buffer area.
  • the background server associates and caches the object information returned by the server of the public comment network and the corresponding area range into the buffer area
  • the background server sets a short expiration time for the object information, and does not need to store the hot spot data for a long time. So as to avoid the use of less cached data for a long time to occupy the storage space of the background server.
  • the user terminal is a smart phone
  • the application program installed on the user terminal is an application scenario of the mobile phone QQ application
  • the third party server is used as a public comment network.
  • the server is used as an example.
  • the foregoing embodiment of the present application provides an optional technical solution, and the method may include the following steps:
  • Step S301 The user sends the location of the merchant through the user terminal to initiate a query request for obtaining the merchant information of the merchant in the vicinity thereof.
  • the user terminal can be a mobile QQ application installed on the smart phone.
  • the user of the smartphone wants to obtain the restaurant information in the vicinity thereof, the user can click “Dynamic” in the QQ application interface of the mobile phone, and further select the “eat, drink and play” option in “Dynamic”. After entering the interface of “eat, drink and play” option, select “Gourmet” in the upper left corner.
  • the mobile QQ application will send a background to the background server according to the options selected by the user and the location information of the mobile phone (such as the specific location of the user). Query request.
  • Step S302 After receiving the query request of the user, the background server queries, in the cache area, whether the area range to which the user belongs is stored according to the location of the user.
  • step S302 is the same as the implementation manner of the step S131 in the foregoing embodiment of the present application, and details are not described herein again.
  • Step S303 is performed when the range of the area to which the user belongs is successfully queried, and step S304 is performed when the range of the area to which the user belongs is not found.
  • Step S303 the background server reads the hotspot data in the area from the buffer area, and returns the hotspot data to the smart phone.
  • the hotspot data may include the name of the store of the merchant in the area, the distance of the merchant from the user terminal, the geographical area information of the merchant, the street information of the merchant, the latitude and longitude information of the merchant, and whether the merchant has a preferential event, etc. .
  • the hotspot data is triggered by the user and the expiration time is set for it in the background, and the expired hotspot data is automatically reconstructed.
  • step S303 is the same as the implementation manner of the step S133 in the foregoing embodiment of the present application, and details are not described herein again.
  • Step S304 The background server forwards the query request of the user to the third-party server to obtain the corresponding hotspot data by accessing the third-party server.
  • the third-party server can be the server of the public comment network.
  • step S304 is the same as the implementation manner of the step S135 in the foregoing embodiment of the present application, and details are not described herein again.
  • Step S305 the third party server returns the corresponding hotspot data to the background server.
  • step S305 optionally, after the server of the public comment network returns the corresponding hotspot data to the background server, the background server caches the hotspot data.
  • step S306 is performed.
  • Step S306 monitoring the performance of the third party server.
  • step S305 is consistent with the implementation of the step of “monitoring the access amount of the third-party server” in the foregoing embodiment of the present application, and details are not described herein again.
  • step S305 can be performed by the merchant interface monitoring device on the background server.
  • step S307 is performed.
  • Step S307 dynamically adjusting the first character string encoding length of the area range, and dynamically adjusting the expiration time of the hotspot data.
  • the first string encoding may be a GeoHash string.
  • the accuracy of the GeoHash string and the expiration time of the hotspot data are dynamically adjusted according to the server performance of the public comment network, and the coverage of the area range can be adjusted by adjusting the length of the GeoHash string, thereby adjusting the hit of the hotspot data cached in the area. rate.
  • the background service pressure is relatively large, especially when the server processing capability of the public comment network becomes a bottleneck, the length of GeoHash is dynamically adjusted, and the coverage of the area is expanded. As the coverage of the area becomes larger, the number of users covered by it becomes also changed. Large, which can increase the hit rate of hotspot data in the region.
  • Dynamically adjusting the expiration time of hotspot data (such as cache timeout failure time), when the server processing capability of the public comment network becomes a bottleneck, monitor the server processing capability of the public comment network and dynamically adjust the expiration time of the hotspot data of the corresponding region to Reduce the public Review the server's processing pressure.
  • step S306 when the user-initiated query request is received again, the process returns to step S302.
  • the two-dimensional latitude and longitude data is converted into a character string by a GeoHash algorithm to represent a certain range of geographical locations, and the GeoHash algorithm is used to cache the merchants in the vicinity of the user, and are executed by other users in the range.
  • the cache can be hit, realizing a low-cost, high-efficiency cache, and by dynamically adjusting the cache area and expiration time, the pressure on the server of the background server and the external partner is reduced, and the user is provided with flexibility. Service.
  • the technical solution of the embodiments of the present application may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic
  • a storage medium such as ROM/RAM, magnetic
  • the disc, the optical disc includes a plurality of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the various embodiments of the present application.
  • the foregoing method for acquiring data based on location information may be applied to a hardware environment formed by the computer terminal A shown in FIG. As shown in FIG. 13, the computer terminal A is connected to other computer terminals through a network, including but not limited to: a wide area network, a metropolitan area network, or a local area network.
  • a network including but not limited to: a wide area network, a metropolitan area network, or a local area network.
  • an apparatus for acquiring data based on location information for implementing the foregoing method for acquiring data based on location information.
  • the apparatus may include: a receiving unit 40, an inquiring unit 41, and Transmitting unit 42.
  • the receiving unit 40 is configured to receive a query request sent by the user terminal for acquiring object information.
  • the query request carries the location information of the user terminal.
  • the background server receives a query request sent by the user terminal for acquiring object information.
  • the user terminal may be a personal computer or a mobile terminal such as a smart phone, a notebook, a tablet, or the like.
  • the object may be a merchant near the user terminal, and the object information may include a distance between the merchant (eg, less than 500 meters), a geographical area of the merchant (such as the XX area of the XX city), and the location of the merchant. Street information, latitude and longitude information of the merchant, the name of the store's store, and whether the merchant has preferential activities.
  • the merchants in the above embodiments may be restaurants, cinemas, hotels, KTVs, tourist attractions, and the like.
  • the location information of the user terminal may include at least one of the following information: latitude and longitude information, street information, geographical area information, attribution of business circle information, and the like.
  • the user terminal before the background server receives the query request sent by the user terminal, the user terminal needs to generate a corresponding query request.
  • the query request can be generated by an application installed on the user terminal.
  • the user holding the user terminal needs to obtain the object information (for example, the user needs to obtain the hotel information in the vicinity thereof)
  • the user can generate a query request carrying the location information of the user terminal through the user terminal, and then the user terminal queries the query.
  • the request is sent to the background server, and the background server receives the query request sent by the user terminal for acquiring the object information.
  • the above query request may be generated by an application installed on the user terminal.
  • the query unit 41 is configured to query the hotspot data in the area of the area where the location information of the user terminal is located from the buffer area if the buffer area is not empty.
  • the hotspot data is information of an object included in the cached area when the frequency of the query access occurs in the area exceeds a predetermined threshold.
  • the background server after receiving the query request sent by the user terminal, when the buffer of the background server is not empty, the background server queries the cache area for the hotspot data in the area where the location information is located.
  • the area range may be a range covering a preset geographic section
  • the area-wide hotspot data may include object information of all merchants within its coverage.
  • the hotspot data is triggered by the user.
  • the hit rate of the business information in the area stored in the cache area is higher.
  • the area is considered to be hot data.
  • the frequency of the query access occurs in the area exceeds a predetermined threshold, that is, when the number of user terminals performing the query operation is large in the area, that is, when there are many users in the area, the area is It is determined as a hotspot area, and the object information of all objects included in the hotspot area is cached as hotspot data in the area range (that is, the hotspot area).
  • the predetermined threshold may be set according to actual application requirements, which is not specifically limited in this application.
  • the query unit 41 may include a query module 411, a read module 413, and an acquisition module 415.
  • the query module 411 is configured to query the area of the area where the location information of the user terminal is located from the buffer area.
  • the buffer area caches at least one preset area range and hotspot data in the area range.
  • the background server After receiving the query request sent by the user terminal, the background server detects the slow response. Whether the storage area is non-empty; when it is detected that the buffer area of the background server is not empty, the area of the area where the user terminal is located is queried from the buffer area according to the location information of the user terminal.
  • At least one preset area range and hotspot data in the area are cached in the buffer area of the background server, where the area range has an association relationship with the hotspot data in the area.
  • the hotspot data within it can be read.
  • the reading module 413 is configured to read the hotspot data in the area range from the buffer area if the query is successful.
  • the hotspot data in the area is read from the buffer area.
  • the obtaining module 415 is configured to obtain hotspot data in the area of the area where the location information of the user terminal is located by accessing the third-party server, and cache the area range and the corresponding hotspot data into the buffer area.
  • the background server needs to forward the query request sent by the user terminal to a third-party server (such as a server of an external partner merchant).
  • a third-party server such as a server of an external partner merchant.
  • the hotspot data in the area of the area where the location information of the user terminal is located is obtained by accessing the third server, and the obtained hotspot data in the area is associated with the area range and then cached in the buffer area of the background server.
  • the hotspot data in the area where the location information of the user terminal is located is obtained by accessing the third-party server, and the area range and the corresponding hotspot data are cached in the buffer area, if the data is received again, The query requesting the object information in the range of the area is returned to the execution query unit 41 to the sending unit 42.
  • the hotspot data in the area is not required to be accessed again by accessing the third party server.
  • the hotspot data in the area can be read directly from the buffer area, thereby reducing the processing pressure of the third party server.
  • the hot spot data in the area where the location information of the user terminal is located by accessing the third-party server may be forwarded to the interface of the third-party server by using the query request (eg,
  • the merchant interface of the partner merchant realizes that, because the processing capability of the merchant interface of the external partner is limited, the pressure of the merchant interface can be greatly alleviated by the above-mentioned embodiment of the present application, that is, the processing pressure of the third-party server is alleviated.
  • the obtained hotspot data may be directly returned to the user terminal by the third-party server, and the hotspot data is returned to the background server for the background server.
  • the hotspot data and the corresponding area range are cached in the buffer area, and the hotspot data may be returned to the user terminal by the background server after the background server completes the cache.
  • the sending unit 42 is configured to send the hotspot data in the obtained area range to the user terminal.
  • the hotspot data in the area where the location information of the user terminal is located is obtained, the hotspot data is returned to the user terminal.
  • the hot spot data in the area where the location information is located is queried from the buffer area according to the location information of the user terminal carried in the query request, and the data is sent to the user terminal.
  • hotspot data such as merchant information
  • the merchant information of the remote location is not cached, and the geographical coverage of the national coverage is not required to be segmented according to a fixed range in the prior art and cached in each section after the division.
  • All business information that is, without having to store all the business information in each section of the country, reduces the required storage space and reduces the storage pressure of the background server.
  • the prior art needs to cache all the merchant information in the background server when searching for the nearby merchant information according to the latitude and longitude, thereby causing technical problems of occupying a large storage space, and reducing the occupation background.
  • the storage space of the server reduces the storage pressure of the background server.
  • the obtaining module 415 may include: a first conversion sub-module 4151 and a cache sub-module 4153.
  • the first conversion sub-module is configured to convert the two-dimensional latitude and longitude data used to represent the area range into a one-dimensional first character string code.
  • the background server converts the two-dimensional latitude and longitude data for indicating the range of the area into a one-dimensional first string code.
  • the two-dimensional latitude and longitude data can be converted into a sortable and comparable one-dimensional string encoding by the GeoHash algorithm, and each string encoding represents a certain range of regions.
  • each string encoding represents a certain range of regions.
  • the accuracy of the range of the range indicated by the GeoHash string is higher.
  • the length of the GeoHash string encoding is 8
  • the accuracy of the range of the range represented by the GeoHash is about 19 meters
  • the GeoHash character is
  • the length of the string code is 9
  • the accuracy of the range of the range indicated by the string is about 2 meters, and the length of the string encoding needs to be selected according to the data.
  • the cache sub-module is configured to cache the hot-spot data in the range of the first string encoded and acquired, and then cache the data to the buffer.
  • the background server converts the two-dimensional latitude and longitude data for indicating the range of the region into the one-dimensional first string encoding
  • the first string encoding and the obtained hotspot data in the region range are associated, , and then cached to the cache of the background server.
  • the length of the first character string encoding can be conveniently adjusted according to the frequency of the query access occurring in the region.
  • the area range represented by the first character string encoding can also conveniently adjust the geographical range covered by the area range, and solves the problem that the prior art divides the board according to the fixed range, and when the size of the section is updated, the update operation. The cumbersome and low-efficiency problem enables a convenient and fast dynamic adjustment of the size of the area.
  • the query module 411 may include: The transformation sub-module 4111, the query sub-module 4113, the first determination sub-module 4115, and the second determination sub-module 4117.
  • the second conversion sub-module is configured to convert the latitude and longitude data in the location information of the user terminal into a second character string code recognizable by the buffer area.
  • the latitude and longitude data in the location information of the user terminal carried in the received query request is converted into a second character string code recognizable by the buffer.
  • the query submodule is configured to query, in the buffer area, whether the first string encoding the same as the second string encoding is stored.
  • the latitude and longitude data of the user terminal is converted by the GeoHash algorithm to a GeoHash character string (ie, the second string code described above) and used to represent the area.
  • the latitude and longitude data of the range is the same as the GeoHash string converted by the GeoHash algorithm (ie, the first string encoding described above). If the first string encoding the same as the second string encoding is queried in the buffer area, the buffer area is indicated. The hotspot data of the area is stored in the area.
  • the first determining submodule is configured to determine that the region range is successfully queried in the case that the first string encoding the same as the second string encoding is stored in the buffer.
  • the hotspot data in the area is read from the buffer area, and the implementation manner of the first determining sub-module is consistent with the implementation manner of the reading module 413 in the foregoing embodiment. , will not repeat them here.
  • the second determining submodule is configured to determine that the query area range fails in a case where the first character string encoding identical to the second string encoding is not stored in the buffer area.
  • the hotspot data in the area of the location where the location information of the user terminal is located is obtained by accessing the third-party server, and the area range and the corresponding hotspot data are cached into the buffer area, and the second determination is performed.
  • the implementation of the sub-module is the same as that of the implementation of the obtaining module 415 in the foregoing embodiment, and details are not described herein again.
  • the location information of the user terminal when the location information of the user terminal is queried according to the location of the user terminal, only the latitude and longitude data of the location of the user terminal needs to be converted into a one-dimensional GeoHash character string, and the GeoHash of each area range stored in the buffer area is The prefix matching of the string is performed.
  • the GeoHash string of the area is the same as the GeoHash string of the user terminal, the area of the area where the user terminal is located in the buffer area can be determined.
  • the query is convenient and fast, and the query efficiency is high. .
  • the above apparatus may further include: a first setting unit 43 and a deleting unit 44.
  • the first setting unit is configured to set a preset expiration time for the hotspot data simultaneously or after buffering to the buffer area after the first character string is encoded and the hotspot data in the acquired area is associated.
  • the expiration time is determined according to the frequency at which the hotspot data is queried.
  • the deleting unit is configured to delete the hotspot data from the buffer when the time when the hotspot data is stored in the buffer reaches the expiration time.
  • a preset expiration time is set for the hotspot data, and When the time when the hotspot data is stored in the buffer reaches the expiration time, the hotspot data is deleted from the cache to achieve the effect of updating the hotspot data in time.
  • the background server receives the query request for acquiring the object information in the area again, it needs to return.
  • the receiving unit 40 to the sending unit 42 are executed.
  • the corresponding hotspot data needs to be obtained by accessing the third party server. Therefore, the length of the expiration time is related to the third party. If the processing time of the server is too short, the third-party server needs to process the query request of the user terminal multiple times, and the processing capability of the third-party server becomes the bottleneck of the entire system, affecting the query efficiency, and cannot timely process the sending of the user terminal.
  • the query request causes the user to wait for a long time and the user experience is poor; if the expiration time is too long, the business information in the area may not be updated in time.
  • the expiration time may be determined according to the frequency at which the hotspot data is queried, that is, according to the hit rate of the hotspot data.
  • the cache area stores hotspot data in the area, and is called Hit the hotspot data, the more times the hotspot data is hit, the higher the hit rate of the hotspot data.
  • the hotspot data in the area is set to a long expiration time, such as 1 day or 2 days, to avoid hot data in the area being repeatedly updated in a short time, resulting in high processing pressure of the background server and the third party server.
  • setting an expiration time for the hotspot data can ensure that the merchant information in the corresponding area is updated in time and effectively, so as to provide the user with the latest business information, such as when adding a new merchant or adding a merchant offer, Provide relevant information to users in a timely manner.
  • the foregoing apparatus may further include: a first monitoring unit 45, an adjusting unit 46, and a first acquiring unit 47.
  • the first monitoring unit is configured to monitor the number of times of querying the same area range from the buffer area in the process of querying the area range of the location information of the user terminal from the buffer area.
  • the adjusting unit is configured to adjust the precision of the first string encoding to expand the coverage of the region range to be queried when the number of queries for querying the same region range from the buffer area exceeds the preset query threshold, and obtain the adjusted region. range.
  • the first obtaining unit is configured to: after receiving the query request for acquiring the object information in the adjusted region, obtain the hotspot data in the adjusted region by accessing the third-party server, and buffer the adjusted region range and The corresponding hotspot data is in the buffer area.
  • the number of queries that query the same area range from the buffer area is monitored, that is, the hit rate of each hotspot data in the buffer area is monitored, and when the number of queries that query the same area range from the buffer area is monitored, the number of queries exceeds
  • the query threshold is preset, it indicates that there are more users in the area to perform the query operation. If there are more users querying the object information at the outer edge of the area, the users at the outer edge will not It will hit the hotspot data in the area. At this time, the processing pressure of the third-party server may be too large, and the query request sent by the user terminal cannot be processed in time. The user waits for a long time and the user experience is poor. Therefore, the monitoring is performed.
  • the precision of the first string encoding may be shortened by shortening the length of the first string encoding, thereby expanding the coverage of the range of the queried region.
  • the adjusted area range can cover a larger geographical range.
  • the adjusted region range after receiving the query request for acquiring the object information in the adjusted region, obtaining the adjusted region-wide hotspot data by accessing the third-party server, and The adjusted area range and the corresponding hotspot data are cached in the buffer area, and the specific implementation manner is the same as the implementation manner of the obtaining module 415 in the foregoing embodiment, and details are not described herein again.
  • the hotspot data in the adjusted area is obtained by accessing the third-party server, and the adjusted area range and the corresponding hotspot data are associated and cached in the buffer area, if Receiving the query request for acquiring the object information in the adjusted region range again, returning to the execution query unit 41 to the sending unit 42, wherein in the process of executing the query unit 41, it is not necessary to obtain the third-party server again.
  • Hotspot data in the area, and the hotspot data in the area can be directly read from the buffer area, thereby reducing the processing pressure of the third-party server.
  • obtaining the hotspot data in the adjusted area by accessing the third-party server It can be implemented by forwarding the query request to the interface of the third-party server (such as the merchant interface of the external partner). Since the processing capability of the merchant interface of the external partner is limited, the above-mentioned embodiment of the present application can greatly alleviate the merchant interface. Stress, reducing the processing pressure of third-party servers.
  • the above apparatus may further include: a second monitoring unit 48 and an extension unit 49.
  • the second monitoring unit is configured to monitor the amount of access of the third-party server in the process of obtaining the hotspot data in the area where the location information of the user terminal is located by accessing the third-party server.
  • the extension unit is configured to extend the expiration time of the hotspot data according to the amount of access if the access volume of the third-party server exceeds the preset access threshold.
  • the processing capability of the third-party server is limited, and the system processing bottleneck is caused in order to avoid the processing capability of the third-party server.
  • you need to monitor the access volume of the third-party server that is, monitor the number of query requests processed by the third-party server.
  • the number of accesses monitored by the third-party server exceeds the preset access threshold, It can be considered that the processing capability of the third-party server has reached the limit, and other query requests cannot be processed in time.
  • the expiration time of the corresponding hot-spot data can be extended according to the amount of the access, and the hot-spot data can be avoided. Repeat updates in a short period of time while reducing the processing pressure on third-party servers.
  • the above apparatus may further include: a second obtaining unit 50 and a second setting unit 51.
  • the second obtaining unit is configured to obtain the hotspot data in the area of the area where the location information of the user terminal is located by accessing the third-party server, and cache the area range and the corresponding hotspot data into the buffer area. .
  • the second setting unit is used to set an expiration time for the hotspot data.
  • the background server after receiving the query request of the user acquiring the object information sent by the user terminal, if the background server detects that the buffer area is empty (such as when the system first starts running or the hotspot data cached in the background server is all expired and the query request is After the query operation is performed, the background server forwards the query request to the third-party server to obtain the hotspot data in the corresponding area by accessing the third-party server, and after obtaining the hot data returned by the third-party server, The background server associates the area range and the corresponding hotspot data into the buffer area, and sets an expiration time for the hotspot data.
  • implementation manners of the foregoing embodiments are consistent with the implementation manners of the obtaining module 415 and the implementation manners of the first setting unit and the deleting unit in the foregoing embodiments of the present application, and details are not described herein again.
  • the foregoing apparatus may further include: a third obtaining unit 52 and a third setting unit 53.
  • the third obtaining unit is configured to acquire object information in the area of the location where the location information of the user terminal is located by accessing the third-party server, and cache the area range and the corresponding object, if the frequency of the query access occurs in the area exceeds a predetermined threshold. Information is in the cache.
  • the third setting unit is configured to set an expiration time for the object information, wherein the expiration time of the object information is less than the expiration time of the hotspot data.
  • the background server forwards the query request to the third-party server, and obtains the corresponding object information by accessing the third-party server, so as to avoid other user terminals querying in the short-term.
  • the object information in the area the background server caches the obtained object information and the corresponding area range into its buffer area, and sets a short expiration time for the object information, so as to avoid using the cached data for a long time to occupy the background server. Storage space.
  • the foregoing apparatus for acquiring data based on location information may be applied.
  • the computer terminal A In the hardware environment constituted by the computer terminal A shown in FIG. As shown in FIG. 13, the computer terminal A is connected to other computer terminals through a network, including but not limited to: a wide area network, a metropolitan area network, or a local area network.
  • Embodiments of the present application may provide a computer terminal, which may be any one of computer terminal groups.
  • the foregoing computer terminal may also be replaced with a terminal device such as a mobile terminal.
  • the computer terminal may be located in at least one network device of the plurality of network devices of the computer network.
  • FIG. 13 is a structural block diagram of a computer terminal according to an embodiment of the present application.
  • the computer terminal A may include one or more (only one shown in the figure) processor 61, memory 63, and transmission device 65.
  • the memory 63 can be used to store software programs and modules, such as the method and device corresponding to the method and device for acquiring data based on the location information in the embodiment of the present application, and the processor 61 runs the software program and the module stored in the memory 63. , thereby performing various functional applications and data processing, that is, implementing the above method of acquiring data based on location information.
  • Memory 63 may include high speed random access memory and may also include non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory.
  • memory 63 may further include memory remotely located relative to processor 61, which may be connected to terminal A via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the transmission device 66 described above is for receiving or transmitting data via a network.
  • Specific examples of the above network may include a wired network and a wireless network.
  • transmission device 66 includes a Network Interface Controller (NIC) that can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network.
  • NIC Network Interface Controller
  • the transmission device 66 is a radio frequency (RF) module for passing no Line mode communicates with the Internet.
  • RF radio frequency
  • the memory 63 is configured to store preset action conditions and information of the preset rights user, and an application.
  • the processor 61 may call the information and the application stored in the memory 63 by the transmission device to perform the following steps: receiving a query request for acquiring the object information sent by the user terminal, where the query request carries the location information of the user terminal; In the case that the buffer area is not empty, the hotspot data in the area where the location information of the user terminal is located is queried from the buffer area, where the hotspot data is the area that is cached when the frequency of query access occurs in the area exceeds a predetermined threshold. The information of the object included in the range; the hotspot data within the obtained area is sent to the user terminal.
  • the processor 61 may further execute the following step: querying, from the buffer area, a range of the area where the location information of the user terminal is located, where the buffer area at least caches a preset area range, and the area range Hotspot data; in the case of successful query, the hotspot data in the area is read from the cache area; if the query fails, the hotspot data in the area where the location information of the user terminal is located is obtained by accessing the third party server, And cache the area range and the corresponding hotspot data into the buffer area.
  • the processor 61 may further execute the following steps: converting the two-dimensional latitude and longitude data used to represent the area range into a one-dimensional first string encoding; encoding and acquiring the first character string Hotspot data within the scope is cached to the cache after association.
  • the processor 61 may further execute the following steps: converting the latitude and longitude data in the location information of the user terminal into a second string code recognizable by the buffer area; and querying whether the storage area is stored in the buffer area.
  • the second string encodes the same first string encoding; if the first string encoding the same as the second string encoding is stored in the buffer, it is determined that the region range is successfully queried; if not stored in the buffer If the second string encodes the same first string encoding, then the range of the query region is determined to have failed.
  • the processor 61 may further execute the following program code: the number of hotspots According to the preset expiration time, the expiration time is determined according to the frequency of the hotspot data being queried; when the time when the hotspot data is stored in the buffer reaches the expiration time, the hotspot data is deleted from the buffer.
  • the processor 61 may further execute the following program code: monitoring the number of queries for querying the same area from the buffer area; and monitoring the number of queries querying the same area from the buffer area exceeds the preset query.
  • the precision of the first string encoding is adjusted to expand the coverage of the region range to be queried, and the adjusted region range is obtained; after receiving the query request for acquiring the object information in the adjusted region, the The third-party server is accessed to obtain the hotspot data in the adjusted area, and the adjusted area range and the corresponding hotspot data are cached in the cache area.
  • the processor 61 may further execute the following program code: monitoring the access volume of the third-party server; and extending the expiration time of the hot-spot data according to the access amount if the access volume of the third-party server exceeds the preset access threshold. .
  • the processor 61 may further execute the following program code: obtain the hotspot data in the area where the location information of the user terminal is located by accessing the third-party server, and cache the area range and the corresponding hotspot data into the buffer area. ; Set expiration time for hotspot data.
  • the processor 61 may further execute the following program code: obtain the object information in the area of the location where the location information of the user terminal is located by accessing the third-party server, and cache the area range and the corresponding object information into the buffer area. Setting an expiration time for the object information, wherein the expiration time of the object information is less than the expiration time of the hotspot data.
  • FIG. 13 is only for illustration, and the computer terminal can also be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, an applause computer, and a mobile Internet device (Mobile Internet Devices, MID). ), PAD and other terminal devices.
  • FIG. 13 does not limit the structure of the above electronic device.
  • computer terminal 10 may also include more or fewer components (such as a network interface, display device, etc.) than shown in FIG. 13, or have a different configuration than that shown in FIG.
  • Embodiments of the present application also provide a storage medium.
  • the storage medium may store the program code of the method for acquiring data based on the location information in the first embodiment.
  • the foregoing storage medium 902 may be located in at least one of a plurality of network devices in a computer network.
  • the storage medium 902 is configured to store program code for performing the following steps: receiving a query request sent by the user terminal for acquiring object information, where the query request carries the user terminal. Location information; in the case that the buffer area is not empty, the hotspot data in the area where the location information of the user terminal is located is queried from the buffer area, wherein the hotspot data is when the frequency of the query access occurs within the area exceeds a predetermined threshold.
  • the information of the object included in the cached area; the hotspot data in the obtained area is sent to the user terminal.
  • the storage medium is further configured to store program code for performing the following steps: querying a range of areas in which the location information of the user terminal is located from the buffer area, wherein the buffer area at least caches a preset area range, and the area Hotspot data in the range; in the case of successful query, the hotspot data in the area is read from the cache area; in the case of the query failure, the third-party server is accessed to obtain the location of the location information of the user terminal. Hotspot data, and cache the area range and corresponding hotspot data to the cache area.
  • the storage medium is further configured to store program code for performing the following steps: converting the two-dimensional latitude and longitude data for representing the area range into a one-dimensional first string encoding; encoding and acquiring the first character string The hotspot data within the range of the area is cached and cached to the cache area.
  • the storage medium is further configured to store program code for performing: converting the latitude and longitude data in the location information of the user terminal into a second string encoding recognizable by the buffer; querying whether to store in the buffer area Having the same first string encoding as the second string encoding; if the first string encoding the same as the second string encoding is stored in the buffer, it is determined that the region range is successfully queried; if not in the buffer region The first string encoding the same as the second string encoding is stored, and it is determined that the query region range fails.
  • the storage medium is further configured to store program code for performing the following steps: setting a preset expiration time for the hotspot data, wherein the expiration time is determined according to the frequency at which the hotspot data is queried; when the hotspot data is stored in the buffer area When the time reaches the expiration time, the hotspot data is deleted from the cache.
  • the storage medium is further configured to store program code for performing the following steps: monitoring the number of queries querying the same area range from the buffer area; and monitoring the number of queries querying the same area range from the buffer area exceeds
  • the threshold is preset
  • the precision of the first string encoding is adjusted to expand the coverage of the region range to be queried, and the adjusted region range is obtained; and the query request for acquiring the object information in the adjusted region is received.
  • the hotspot data in the adjusted area is obtained by accessing the third-party server, and the adjusted area range and the corresponding hotspot data are cached in the buffer area.
  • the storage medium is further configured to store program code for performing the following steps: monitoring the access amount of the third-party server; and extending the hotspot data according to the access amount if the access amount of the third-party server exceeds the preset access threshold Expiration time.
  • the storage medium is further configured to store program code for performing the following steps: obtaining the hotspot data in the area of the location where the location information of the user terminal is located by accessing the third-party server, and buffering the area range and the corresponding hotspot data to In the cache area; set the expiration time for hotspot data.
  • the storage medium is further configured to store program code for performing the following steps: obtaining object information in the area of the location where the location information of the user terminal is located by accessing the third-party server, and buffering the area range and the corresponding object information to In the cache area, an expiration time is set for the object information, wherein the expiration time of the object information is less than the expiration time of the hot item data.
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the integrated unit in the above embodiment if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in the above-described computer readable storage medium.
  • the technical solution of the embodiments of the present application may be embodied in the form of a software product in the form of a software product in essence or in the form of a contribution to the prior art, and the computer software product is stored in the storage medium.
  • a number of instructions are included to cause one or more computer devices (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the disclosed client may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interface, indirect coupling of the unit or module or The communication connection can be in electrical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Remote Sensing (AREA)
  • Information Transfer Between Computers (AREA)
  • Telephonic Communication Services (AREA)
  • Telephone Function (AREA)

Abstract

本申请实施例公开了一种基于位置信息获取数据的方法和装置。其中,该方法包括:接收用户终端发送的用于获取对象信息的查询请求,其中,查询请求中携带有用户终端的位置信息;在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据,其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息;将得到的区域范围内的热点数据发送至用户终端。本申请实施例解决了现有技术中在根据经纬度搜索附近的商家信息时,在后台服务器中需要缓存所有的商家信息,导致占用较大的存储空间的技术问题。

Description

基于位置信息获取数据的方法和装置
本申请要求于2015年08月03日提交中国专利局、申请号为201510482174.0、发明名称为“基于位置信息获取数据的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及数据处理领域,具体而言,涉及一种基于位置信息获取数据的方法和装置。
背景技术
基于位置服务(Location Based Service,简称LBS)是一种通过电信移动运营商的无线电通讯网络(如GSM网、CDMA网等)或者外部定位方式(如GPS)获取移动终端用户的位置信息(如地理坐标,或大地坐标),在地理信息系统(Geographic Information System,简称GIS)平台的支持下,为用户提供相应服务的一种增值业务。
LBS包括两层含义:首先是确定移动设备或者用户所在的地理位置;其次是提供与地理位置相关的各类信息服务。例如,找到手机用户的当前地理位置(如位于北京市内),然后在北京市的范围内寻找该手机用户当前位置处1公里范围内的宾馆、影院、图书馆、加油站等的名称和地址等信息。
在现有技术中,可以通过移动终端或者用户所在的经纬度信息来搜索移动终端或者用户附近的商家信息(如,餐厅、超市、医院、宾馆、影院、图书馆、加油站等的名称和地址等信息)。具体地,按照固定的范围对覆盖的地理板块进行切分(例如,将北京市所对应的地理板块划分为多个边长为1公里的正方形),得到多个切分后的版块,并将每一个切分后的版 块中所包含的所有商家信息作为业务数据缓存至后台服务器中。
当某个版块内的用户向后台服务器发送位置信息(如,用户的经纬度信息)请求附近的商家信息(如距用户当前位置1公里范围内的餐厅信息)时,根据该用户的经纬度信息判断命中了哪个板块,然后直接获取缓存中保存的该板块对应的业务数据。
但是,现有技术中的搜索方案具有如下的缺点:
(1)当用户需要不同时,例如位于同一地点的两个用户中的一个要求附近100米内的商家信息,而另一个用户要求附近500米内的商家信息,此时需要分别针对这两个用户的需求进行业务数据缓存;并且由于需要全量存储全国各个板块内的所有商家信息,占用的存储空间较大;
(2)需要根据商家覆盖的地理范围进行版块划分(如,对同一地区需按照不同的固定范围进行多次划分,以满足用户的需求),不同版块内的所有商家信息的数据量很大,在构建业务数据时需要花费较长时间,且需要较大的存储空间,导致业务数据的构建非常繁琐;
(3)当板块的大小更新的时候,由于版块以二维的经纬度信息表示,导致版块更新范围时操作繁琐,并且需要重建版块内的所有业务数据,导致更新效率低。
针对现有技术中在根据经纬度搜索附近的商家信息时,在后台服务器中需要缓存所有的商家信息,导致占用较大的存储空间的技术问题,目前尚未提出有效的解决方案。
发明内容
本申请实施例提供了一种基于位置信息获取数据的方法和装置,以至少解决现有技术中在根据经纬度搜索附近的商家信息时,在后台服务器中需要缓存所有的商家信息,导致占用较大的存储空间的技术问题。
根据本申请实施例的一个方面,提供了一种基于位置信息获取数据的 方法,包括:接收用户终端发送的用于获取对象信息的查询请求,其中,查询请求中携带有用户终端的位置信息;在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据,其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息;将得到的区域范围内的热点数据发送至用户终端。
根据本申请实施例的另一方面,还提供了一种基于位置信息获取数据的装置,包括:接收单元,用于接收用户终端发送的用于获取对象信息的查询请求,其中,查询请求中携带有用户终端的位置信息;查询单元,用于在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据,其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息;发送单元,用于将得到的区域范围内的热点数据发送至用户终端。
采用本申请实施例,接收用户终端发送的用于获取对象信息的查询请求,其中,查询请求中携带有用户终端的位置信息;在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据,其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息;将得到的区域范围内的热点数据发送至用户终端,解决了现有技术中在根据经纬度搜索附近的商家信息时,在后台服务器中需要缓存所有的商家信息,导致占用较大的存储空间的技术问题,实现了减小占用后台服务器的存储空间的效果。
附图说明
此处所说明的附图用来提供对本申请实施例的进一步理解,构成本申请的一部分,本申请实施例的示意性实施例及其说明用于解释本申请实施例,并不构成对本申请实施例的不当限定。在附图中:
图1是根据本申请实施例一的一种基于位置信息获取数据的方法的流程图;
图2是根据本申请实施例一的一种可选的基于位置信息获取数据的方法的流程图;
图3是根据本申请实施例一的另一种可选的基于位置信息获取数据的方法的流程图;
图4是根据本申请实施例二的一种基于位置信息获取数据的装置的结构示意图;
图5是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图6是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图7是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图8是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图9是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图10是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图11是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;
图12是根据本申请实施例二的一种可选的基于位置信息获取数据的装置的结构示意图;以及
图13是根据本申请实施例的一种计算机终端的结构框图。
具体实施方式
为了使本技术领域的人员更好地理解本申请实施例方案,下面将结合本申请实施例实施例中的附图,对本申请实施例实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请实施例一部分的实施例,而不是全部的实施例。基于本申请实施例中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请实施例保护的范围。
需要说明的是,本申请实施例的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
下面对本申请实施例涉及到的术语进行解释如下:
GeoHash算法:是将二维的经纬度信息转换成一个可以排序、可以比较的字符串编码。GeoHash算法有如下几个特点,首先GeoHash算法是用一个字符串编码表示经度和纬度两个坐标;其次,GeoHash算法转换得到的字符串编码表示的并不是一个点,而是一个矩形区域;第三,字符串编码的前缀可以表示更大的区域,这个特性可以用于附近地点的搜索。
实施例1
根据本申请实施例,提供了一种基于位置信息获取数据的方法,如图1所示,该方法可以包括如下步骤:
步骤S10,接收用户终端发送的用于获取对象信息的查询请求。其中,查询请求中携带有用户终端的位置信息。
在一个可选的实施例中,可以通过后台服务器接收用户终端发送的用于获取对象信息的查询请求。
在本申请实施例上述步骤S10中,用户终端可以为个人计算机或移动终端,如智能手机、笔记本、平板电脑等。可选地,上述的对象可以为用户终端附近的商家,对象信息可以包括如下任意一种或多种数据:商家距用户终端的距离(如小于500米)、商家的所处地理区域信息(如XX市XX区)、商家所在的街道信息、商家的经纬度信息、商家的门店名称以及商家是否有优惠活动等。
可选地,上述实施例中的商家可以为饭店、电影院、酒店、KTV以及旅游景点等。
在本申请实施例上述步骤S10中,用户终端的位置信息可以包括如下信息中的至少一种:经纬度信息、街道信息、所处地理区域信息、所归属的商圈信息等。
在一个可选的实施例中,在后台服务器接收用户终端发送的查询请求之前,用户终端需要生成相应的查询请求。具体地,可以通过用户终端上安装的应用程序实现生成查询请求。当持有用户终端的用户需要获取对象信息(如,用户需要获取其附近的饭店信息)时,该用户可以通过其用户终端生成携带有用户终端的位置信息的查询请求,然后用户终端将该查询请求发送至后台服务器,后台服务器接收用户终端发送的用于获取对象信息的该查询请求。
可选地,可以通过用户终端上安装的应用程序生成上述的查询请求。例如,以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景为例,对本申请实施例上述实施例进行说明。当智能手机的用户想要获取其附近的饭店信息时,该用户可以通过点击手机QQ应 用程序界面中的“动态”,并进一步地选择“动态”中的“吃喝玩乐”选项,在进入“吃喝玩乐”选项的界面之后,选择左上角的“美食”,此时手机QQ应用程序将按照用户选择的选项以及手机的位置信息(如用户所处的具体位置)向后台服务器发送一个查询请求。
又如,以用户终端为智能手机、用户终端上安装的应用程序为手机微信为应用场景为例,对本申请上述实施例进行说明。当智能手机的用户想要获取其附近的饭店信息时,该用户可以通过点击手机微信界面中的“我”,并进一步地选择“我”中的“吃喝玩乐”选项,在进入“吃喝玩乐”选项的界面之后,选择左上角的“美食”,此时手机微信将按照用户选择的选项以及手机的位置信息(如用户所处的具体位置)向后台服务器发送一个查询请求。
步骤S13,在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据。其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息。
在本申请实施例上述步骤S13中,在接收到用户终端发送的查询请求之后,当后台服务器的缓存区非空时,后台服务器从缓存区查询上述的位置信息所在的区域范围内的热点数据。
可选地,区域范围可以为覆盖了预先设置的地理板块的范围,区域范围的热点数据可以包括其覆盖范围内的所有商家的对象信息。
此处需要说明的是,区域范围所覆盖的范围是可以根据需要动态调节的,具体内容将在本申请后续实施例中进行介绍,在此不再详述。
在本申请上述实施例中,热点数据是由用户触发的,当某一区域范围对应的商家信息被查询的次数较高时,缓存区中存储的该区域范围内的商家信息的命中率较高,该区域范围即被认为是热点数据。具体地,当区域范围内发生查询访问的频率超过预定阈值时,即该区域范围内执行查询操作的用户终端的数量较多时,也即该区域范围内聚集的用户较多时,则将 该区域范围确定为热点地区,并缓存该热点地区内所包含的所有对象的对象信息作为该区域范围(也即该热点地区)内的热点数据。
可选地,预定阈值可以根据实际应用需求而设定,本申请实施例对此不作具体限定。
根据本申请上述实施例,上述步骤S13,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据可以包括如图2所示的步骤:
步骤S131,从缓存区中查询用户终端的位置信息所在的区域范围。其中,缓存区至少缓存一个预先设置的区域范围,以及区域范围内的热点数据。
具体地,在接收到用户终端发送的查询请求之后,后台服务器检测缓存区是否非空;当检测到后台服务器的缓存区非空时,根据用户终端的位置信息从缓存区中查询用户终端所处的区域范围。
继续以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景为例,对本申请上述实施例进行说明。当手机QQ应用程序将携带有手机当前所在地点的位置信息(如经纬度信息)的查询请求发送至后台服务器之后,后台服务器检测其缓存区是否非空,在检测到缓存区非空的情况下,根据用户的经纬度信息从缓存区中查询手机当前所在地点所属的区域范围。
可选地,后台服务器的缓存区中至少缓存有一个预先设置的区域范围以及该区域范围内的热点数据,其中,区域范围与其内的热点数据具有关联关系。当查询到该区域范围时,即可读取到其内的热点数据。
步骤S133,在查询成功的情况下,从缓存区中读取区域范围内的热点数据。
具体地,在成功查询到用户终端的位置信息所在的区域范围时,也即查询成功时,从缓存区中读取该区域范围内的热点数据。
继续以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景为例,对本申请上述实施例进行说明。当手机QQ应用程序将携带有手机当前所在地点的位置信息(如经纬度信息)的查询请求发送至后台服务器之后,后台服务器检测其缓存区是否非空,在检测到缓存区非空的情况下,根据用户的经纬度信息从缓存区中查询手机当前所在地点所属的区域范围。在成功查询到该手机当前所在地点所属的区域范围(如北京市海淀区知春路地铁附近500米)之后,从缓存区中读取北京市海淀区知春路地铁附近500米内的所有饭店信息,如饭店的名称、距手机当前所在地点的距离、是否有优惠活动以及饭店的具体位置等。
步骤S135,在查询失败的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中。
可选地,在未查询到用户终端的位置信息所在的区域范围时,也即查询失败时,后台服务器需要将用户终端发送的查询请求转发至第三方服务器(如外部合作商家的服务器)处理,通过访问第三服务器来获取用户终端的位置信息所在的区域范围内的热点数据,并将获取到的该区域范围内的热点数据与该区域范围关联之后缓存至后台服务器的缓存区中。
在一个可选的实施例中,当通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中之后,若再次接收到用于获取该区域范围内的对象信息的查询请求,则返回执行步骤S13至S15,其中,在执行步骤S13的过程中,无需再次通过访问第三方服务器获取该区域范围内的热点数据,而可以直接从缓存区中读取该区域范围内的热点数据,从而实现了减轻第三方服务器的处理压力。
可选地,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据可以通过将查询请求转发至第三方服务器的接口(如外部合作商家的商家接口)实现,由于外部合作商家的商家接口的处理能力 有限,因此,通过本申请上述实施例,可以大大缓解商家接口的压力,也即减轻第三方服务器的处理压力。
进一步可选地,在将通过访问第三方服务器获取到的热点数据之后,可以通过第三方服务器直接将获取到的热点数据返回至用户终端,并将该热点数据返回至后台服务器,以供后台服务器将该热点数据及对应的区域范围缓存至缓存区中,也可以在后台服务器完成缓存之后,由后台服务器将该热点数据返回至用户终端。
继续结合上述的以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,对本申请上述实施例进行说明。
例如,当手机QQ应用程序将携带有手机当前所在地点的位置信息(如经纬度信息)的查询请求发送至后台服务器之后,后台服务器检测其缓存区是否非空,在检测到缓存区非空的情况下,根据用户的经纬度信息从缓存区中查询手机当前所在地点所属的区域范围。
在该实施例中,在未从缓存区中查询到该手机当前所在地点所属的区域范围之后,将用户的查询请求转发至大众点评网的服务器进行处理,由大众点评网的服务器根据手机当前所在地点确定其所属的区域范围(如北京市海淀区知春路地铁附近500米),并将该区域范围内的所有饭店信息(如饭店的名称、距手机当前所在地点的距离、是否有优惠活动以及饭店的具体位置等)返回至后台服务器,后台服务器将大众点评网的服务器返回的热点数据及对应的区域范围(如北京市海淀区知春路地铁附近500米)关联之后缓存至缓存区中。
可选地,在再次接收到用于获取该区域范围内的对象信息的查询请求时,无需再次通过第三方服务器获取对应的热点数据,而可以直接从缓存区中读取该热点数据,减轻了第三方服务器的处理压力。
步骤S15,将得到的区域范围内的热点数据发送至用户终端。
具体地,在查询得到用户终端的位置信息所在的区域范围内的热点数据之后,将该热点数据返回至用户终端。
继续以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景为例,对本申请上述实施例进行说明。当手机QQ应用程序将携带有手机当前所在地点的位置信息(如经纬度信息)的查询请求发送至后台服务器之后,后台服务器检测其缓存区是否非空,在检测到缓存区非空的情况下,根据用户的经纬度信息从缓存区中查询手机当前所在地点所属的区域范围。在通过缓存区或者通过第三方服务器获取到该手机当前所在地点所属的区域范围(如北京市海淀区知春路地铁附近500米)内的所有饭店信息(如饭店的名称、距手机当前所在地点的距离、是否有优惠活动以及饭店的具体位置等)之后,后台服务器将获取到的所有饭店信息返回至手机QQ应用程序,手机QQ应用程序将接收到的热点数据展示在显示界面中,以供用户查看。
采用本申请实施例,在接收到用户终端发送的查询请求之后,根据查询请求中携带的用户终端的位置信息从缓存区中查询该位置信息所在的区域范围内的热点数据,实现向用户终端发送其所在区域范围内的对象信息。在本申请实施例中,通过在缓存区中存储聚集用户较多的区域范围的热点数据(如商家信息),可以保证大多数用户在获取附近商家信息时可以从缓存区中查询到对应的热点数据,如偏远地点无用户执行查询操作时,则不缓存该偏远地点的商家信息,无需现有技术中按照固定的范围将全国覆盖的地理板块切分并在切分之后缓存每个板块内的所有商家信息,即无需全量存储全国各个板块内的所有商家信息,减小了所需的存储空间,降低了后台服务器的存储压力。通过本申请实施例,解决了现有技术中在根据经纬度搜索附近的商家信息时,在后台服务器中需要缓存所有的商家信息,导致占用较大的存储空间的技术问题,实现了减小占用后台服务器的存储空间,降低后台服务器的存储压力的效果。
在本申请上述实施例中,步骤S135中,缓存区域范围及对应的热点 数据至缓存区中可以包括:
步骤S1351,将用于表示区域范围的二维经纬度数据转化为一维的第一字符串编码。
具体地,在通过访问第三方服务器获取到用户终端的位置信息所在的区域范围内的热点数据之后,后台服务器将用于表示该区域范围的二维经纬度数据转化为一维的第一字符串编码。
在一个可选的实施例中,可以通过GeoHash算法将二维的经纬度数据转化为一个可排序、可比较的一维的字符串编码,每一个字符串编码表示某一区域范围。其中,当GeoHash字符串编码长度越长时,其所表示的区域范围的精度越高,例如GeoHash字符串编码长度为8时,其所表示的区域范围的精度在19米左右,而当GeoHash字符串编码长度为9时,其所表示的区域范围的精度在2米左右,字符串编码的长度需要根据数据情况进行选择。
步骤S1353,将第一字符串编码和获取到的区域范围内的热点数据关联之后缓存至缓存区。
具体地,在后台服务器将用于表示该区域范围的二维经纬度数据转化为一维的第一字符串编码之后,将该第一字符串编码和获取到的该区域范围内的热点数据关联之后,再缓存至后台服务器的缓存区。
继续以通过GeoHash算法将二维的经纬度数据转化为一维的字符串编码的应用场景为例,对本申请上述实施例进行说明。例如,将北京市所覆盖的地理范围预先划分为9个区域范围(如矩形区域),各个矩形区域的第一字符串编码(如GeoHash字符串)分别是WX4ER、WX4G2、WX4G3等等,每一个GeoHash字符串代表了某一矩形区域。也就是说,这个矩形区域内所有的点(以经纬度坐标表示各个点的位置)都共享相同的GeoHash字符串,这样既可以保护隐私(只表示大概区域位置而不是具体的点),又比较容易做缓存。比如WX4ER这个矩形区域内的用户不断发 送位置信息向后台服务器请求其附近的饭店信息(即上述的热点数据),由于WX4ER这个矩形区域内的所有用户的GeoHash字符串都是WX4ER,所以可以把WX4ER当作key,把该矩形区域的热点数据当作value来进行缓存,而如果不使用GeoHash的话,由于同一矩形区域内的用户发送的经纬度数据是各不相同的,很难做缓存。
此处需要进一步说明的是,GeoHash字符串相似的则表示距离相近,这样可以利用GeoHash字符串的前缀匹配来查询附近的商家信息。
通过本申请上述实施例,由于将二维的经纬度数据转化为一维的第一字符串编码,可根据区域范围内发生查询访问的频率方便地通过调整该第一字符串编码的长度,实现调节该第一字符串编码所表示的区域范围,也即可方便地调节区域范围所覆盖的地理范围,解决了现有技术中按照固定的范围切分板块,当板块的大小有更新时,更新操作繁琐,更新效率低的问题,实现了可方便快速的动态调节区域范围的大小。
根据本申请上述实施例,步骤S131,从缓存区中查询用户终端的位置信息所在的区域范围可以包括:
步骤S1311,将用户终端的位置信息中的经纬度数据转化为缓存区可识别的第二字符串编码。
具体地,在后台服务器的缓存区非空时,将接收到的查询请求中携带的用户终端的位置信息中的经纬度数据转化为缓存区可识别的第二字符串编码。
继续以通过GeoHash算法将二维的经纬度数据转化为一维的字符串编码的应用场景为例,对本申请上述实施例进行说明。例如,通过GeoHash算法将用户终端的经纬度数据转化为一维的GeoHash字符串。
步骤S1313,在缓存区中查询是否存储有与第二字符串编码相同的第一字符串编码。
其中,在查询到缓存区中存储有与第二字符串编码相同的第一字符串 编码的情况下,执行步骤S1315;在缓存区中未存储与第二字符串编码相同的第一字符串编码的情况下,执行步骤S1317。
具体地,在后台服务器的缓存区中查询是否存储有与第二字符串编码相同的第一字符串编码。
可选地,当用户终端的经纬度数据落在某一区域范围内时,该用户终端的经纬度数据经GeoHash算法转化得到的GeoHash字符串(即上述的第二字符串编码)与用于表示该区域范围的经纬度数据经GeoHash算法转化得到的GeoHash字符串(即上述的第一字符串编码)相同,若在缓存区中查询到与第二字符串编码相同的第一字符串编码,则表示缓存区中存储有该区域范围的热点数据,此时确定成功查询到了区域范围;若在缓存区中未查询到与第二字符串编码相同的第一字符串编码,则表示缓存区中没有存储该区域范围的热点数据,此时确定查询区域范围失败。
步骤S1315,确定成功查询到区域范围。
具体地,在成功查询到区域范围的情况下,从缓存区中读取该区域范围内的热点数据,该步骤S1315的实现方式与上述实施例中的步骤S133的实现方式一致,在此不再赘述。
步骤S1317,确定查询区域范围失败。
具体地,在查询区域范围失败的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中,该步骤S1317的实现方式与上述实施例中的步骤S135的实现方式一致,在此不再赘述。
下面结合上述的以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,对本申请上述实施例进行说明。
例如,当手机QQ应用程序将携带有手机当前所在地点的位置信息(如经纬度信息)的查询请求发送至后台服务器之后,后台服务器检测其缓存 区是否非空,在检测到缓存区非空的情况下,利用GeoHash算法将用户的经纬度信息转化为一维的第二字符串编码,并从缓存区中查询是否存储有与该第二字符串编码相同的第一字符串编码(用于表示区域范围的字符串编码)。
在该实施例中,在成功查询到缓存区存储有与该第二字符串编码相同的第一字符串编码时,确定查询区域范围成功,即缓存区中存储有手机当前所在地点所属的区域范围(如北京市海淀区知春路地铁附近500米)的热点数据,然后从缓存区中读取北京市海淀区知春路地铁附近500米内的所有饭店信息并返回至手机QQ应用程序,以供用户查看。
在未查询到缓存区存储有与该第二字符串编码相同的第一字符串编码时,确定查询区域范围失败,即缓存区中没有手机当前所在地点所属的区域范围(如北京市海淀区知春路地铁附近500米)的热点数据,然后,后台服务器将用户的查询请求转发至大众点评网的服务器进行处理,由大众点评网的服务器根据手机当前所在地点确定其所属的区域范围(如北京市海淀区知春路地铁附近500米),并将该区域范围内的所有饭店信息(如饭店的名称、距手机当前所在地点的距离、是否有优惠活动以及饭店的具体位置等)返回至后台服务器,后台服务器将对应的区域范围(如北京市海淀区知春路地铁附近500米)通过GeoHash算法转化为一维的第一字符串编码,并将该第一字符串编码与大众点评网的服务器返回的热点数据关联之后缓存至缓存区中。
可选地,可以由大众点评网的服务器将该热点数据返回至手机QQ应用程序中,以供用户查看,也可以由后台服务器在将该第一字符串编码与返回的热点数据缓存至缓存区中之后,将该热点数据返回至手机QQ应用程序。
通过本申请上述实施例,根据用户终端所在位置查询其附近的商家信息时,只需要将用户终端所在位置的经纬度数据转换成一维的GeoHash字符串,并与缓存区中存储的各个区域范围的GeoHash字符串进行前缀匹 配,当区域范围的GeoHash字符串与用户终端所在位置的GeoHash字符串相同时,即可确定缓存区中存储有用户终端所在位置所处的区域范围,查询方便快捷、查询效率高。
在本申请上述实施例中,在将第一字符串编码和获取到的区域范围内的热点数据关联之后缓存至缓存区的同时或之后,上述的方法还可以包括:为热点数据设置预设的过期时间,其中,过期时间根据热点数据被查询的频率确定;当热点数据存储在缓存区的时间达到过期时间时,将热点数据从缓存区中删除。
具体地,当将通过第三方服务器获取到的热点数据与用于表示对应的区域范围的第一字符串关联缓存至缓存区的同时或之后,为该热点数据设置预设的过期时间,并在热点数据存储于缓存区的时间达到该过期时间时,将热点数据从缓存区中删除,达到及时更新热点数据的效果。
在一个可选的实施例中,当某一区域范围内的热点数据达到其过期时间并被删除之后,若后台服务器再次接收到用于获取该区域范围内的对象信息的查询请求,则需要返回执行上述步骤S10至S15,此时,由于后台服务器中没有存储该区域范围内的热点数据,则需要通过访问第三方服务器来获取相应的热点数据。因此,过期时间的长短关系到第三方服务器的处理压力,若过期时间偏短,那么第三方服务器需要多次处理用户终端的查询请求,而导致第三方服务器的处理能力成为整个系统的瓶颈,影响查询效率,无法及时处理用户终端发送的查询请求,导致用户等待时间长,用户体验差;过期时间偏长则可能导致无法及时更新区域范围内的商家信息。
可选地,过期时间可以根据热点数据被查询的频率确定,也即根据热点数据的命中率确定。
需要进一步说明的是,在本申请实施例中,当用户终端发送的查询请求是请求获取某一区域范围内的对象信息时,缓存区存储有该区域范围内的热点数据,则此时称为命中该热点数据,命中该热点数据的次数越多, 则表示该热点数据的命中率越高。
在一个可选的实施例中,当某一区域范围内的一家或多家商家进行优惠活动时,可能会在短期内吸引较多的用户在该区域范围内执行查询操作,此时,可以为该区域范围内的热点数据设置较长的过期时间,如1天或2天,以避免该区域内的热点数据在短时间内重复更新,导致后台服务器和第三方服务器的处理压力大。
通过本申请上述实施例,为热点数据设置过期时间可以保证及时有效地更新对应的区域范围内的商家信息,以为用户提供最新的商家信息,如在新增商家或者新增商家优惠活动时,可以及时向用户提供相关信息。
下面结合上述的以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,对本申请上述实施例进行说明。在后台服务器将用户的查询请求转发至大众点评网的服务器进行处理,由大众点评网的服务器根据手机当前所在地点确定其所属的区域范围(如北京市海淀区知春路地铁附近500米),并将该区域范围内的所有饭店信息返回至后台服务器之后,在后天服务器将对应的区域范围(如北京市海淀区知春路地铁附近500米)通过GeoHash算法转化为一维的第一字符串编码,并将该第一字符串编码与大众点评网的服务器返回的热点数据关联之后缓存至缓存区中的同时或者之后,后台服务器为该热点数据设置与其对应的过期时间,该过期时间可以根据该热点数据的命中率进行动态调节,即当该热点数据的命中率较高时,也即当对应的区域范围内有较多用户在执行查询操作时,可以延长其过期时间,以减轻后台服务器重复更新该区域范围内的热点数据的压力,而当该热点数据的命中率降低至低于预定阈值时,可以认为对应的区域范围内的用户数量偏低,无需再长期存储该热点数据,此时可以将其过期时间缩短,以避免用处不大的缓存数据长期占用后台服务器的存储空间。
在本申请上述实施例中,在从缓存区中查询用户终端的位置信息所在的区域范围的过程中,上述的方法还可以包括:监控从缓存区中查询同一 个区域范围的查询次数;在监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,调整第一字符串编码的精度以扩大被查询的区域范围的覆盖范围,得到调整后的区域范围;在接收到用于获取调整后的区域范围内的对象信息的查询请求之后,通过访问第三方服务器获取调整后的区域范围内的热点数据,并缓存调整后的区域范围及对应的热点数据至缓存区中。
可选地,对从缓存区中查询相同的区域范围的查询次数进行监控,也即监控缓存区中的各个热点数据的命中率,当监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,表示该区域范围内的有较多的用户在执行查询操作,若在该区域范围外部边缘处也有较多的用户在查询对象信息,则该外部边缘处的用户们将不会命中该区域范围内的热点数据,此时可能导致第三方服务器的处理压力过大,无法及时处理用户终端发送的查询请求,导致用户等待的时间久,用户体验差,因此,在监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,可以通过缩短第一字符串编码的长度来降低第一字符串编码的精度,从而扩大被查询的区域范围的覆盖范围,得到调整后的区域范围。其中,该调整后的区域范围可以覆盖更大的地理范围。
进一步地,在得到调整后的区域范围之后,在接收到用于获取该调整后的区域范围内的对象信息的查询请求之后,通过访问第三方服务器获取调整后的区域范围的热点数据,并将该调整后的区域范围及对应的热点数据关联之后缓存至缓存区中,该步骤的具体实现方式与上述实施例中步骤S135的实现方式一致,在此不再赘述。
在一个可选的实施例中,在通过访问第三方服务器获取该调整后的区域范围内的热点数据,并将该调整后的区域范围及对应的热点数据关联之后缓存至缓存区中之后,若再次接收到用于获取该调整后的区域范围内的对象信息的查询请求,则返回执行步骤S13至S15,其中,在执行步骤S13的过程中,无需再次通过访问第三方服务器获取该区域范围内的热点数据, 而可以直接从缓存区中读取该区域范围内的热点数据,从而实现了减轻第三方服务器的处理压力。
可选地,通过访问第三方服务器获取调整后的区域范围内的热点数据可以通过将查询请求转发至第三方服务器的接口(如外部合作商家的商家接口)实现,由于外部合作商家的商家接口的处理能力有限,因此,通过本申请上述实施例,可以大大缓解商家接口的压力,减轻第三方服务器的处理压力。
下面结合上述的以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,对本申请上述实施例进行说明。当后台服务器监控到从缓存区中查询相同的区域范围(如北京市天安门附近300米)的查询次数超过预设查询阈值时,表示北京市天安门附近300米内有较多的用户在通过其手机QQ应用程序执行饭店信息的查询操作,此时,北京市天安门附近300米至1500米内的用户更多且通过其手机执行附近饭店信息的查询操作,则北京市天安门附近300米至1500米内的用户的查询操作无法命中北京市天安门附近300米内的热点数据(如饭店信息),此时,可能会需要大众点评网的服务器处理这部分用户的查询请求,由于大众点评网的服务器的处理能力有限,其只能处理有限个数(如1000个)的查询请求,那么将导致部分用户会等待较长时间,造成用户体验差。在这种情况下,可以将用于表示北京市天安门附近300米内的GeoHash字符串的编码长度降低,如由6位编码(表示约0.34平方千米范围)降低为5位编码(表示10平方千米范围),从而可以表示北京市天安门附近1500米内的区域范围。当在得到调整后的区域范围(如北京市天安门附近1500米内)之后,在接收到手机QQ应用程序发送的查询附近饭店信息的查询请求之后,后台服务器将用户的查询请求转发至大众点评网的服务器进行处理,由大众点评网的服务器根据手机当前所在地点确定其所属的区域范围(如北京市天安门附近1500米内),并将该区域范围内的所有饭店信息(如饭店的名称、距手机当前所在地点的距离、是否有优惠活动以及饭店的具体位置等)返 回至后台服务器,后台服务器将大众点评网的服务器返回的热点数据及对应的区域范围(如北京市天安门附近1500米内)关联之后缓存至缓存区中。可选地,在再次接收到用于获取北京市天安门附近1500米内的对象信息的查询请求(如获取附近饭店信息的查询请求)时,无需再次通过大众点评网的服务器获取对应的热点数据(如饭店信息),而可以直接从缓存区中读取该热点数据,减轻了大众点评网的服务器的处理压力。
根据本申请上述实施例,在通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据的过程中,上述的方法还可以包括:监控第三方服务器的访问量;在第三方服务器的访问量超过预设访问阈值的情况下,根据访问量延长热点数据的过期时间。
可选地,在通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据的过程中,由于第三方服务器的处理能力有限,为了避免第三方服务器的处理能力导致系统处理瓶颈,避免用户长时间等待而降低用户体验,需要对第三方服务器的访问量进行监控,也即监控第三方服务器处理的查询请求的数量,当监控到第三方服务器的访问量超过预设访问阈值时,可以认为此时第三方服务器的处理能力已到极限,无法继续及时处理其他的查询请求,为了缓解第三方服务器的压力,可以根据访问量的大小而延长相应热点数据的过期时间,通过避免热点数据在短时间内重复更新,而降低第三方服务器的处理压力。
继续结合上述的以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,对本申请上述实施例进行说明。在通过访问大众点评网的服务器获取手机所在的区域范围内(如北京市海淀区知春路地铁附近500米)的热点数据(如饭店信息)的过程中,若后台服务器监控到转发至大众点评网的服务器的查询请求的数量超过预设访问阈值,表示大众点评网的服务器的处理能力已达到其上限,此时若还将查询请求转发至大众点评网的服务器,则会导致后面的查询请求暂时无法处理,进而导致部分用户需要等待 较长时间,降低了用户的体验。此时可以将北京市海淀区知春路地铁附近500米内对应的饭店信息的过期时间延长,以使其在缓存区的存储时间延长,从而降低了热点数据的更新频率,当有用户请求获取北京市海淀区知春路地铁附近500米内的饭店信息时,无需将其请求转发至大众点评网的服务器,而直接从后台服务器的缓存区中读取相应的饭店信息即可,以减轻大众点评网的服务器处理各个用户请求的压力,并且还可以减轻后台服务器重复更新该区域范围内的热点数据的处理压力。
根据本申请上述实施例,在缓存区为空的情况下,上述的方法还可以包括:通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中;为热点数据设置过期时间。
可选地,在接收到用户终端发送的用户获取对象信息的查询请求之后,若后台服务器检测缓存区为空(如系统刚开始运行时或者后台服务器内缓存的热点数据全部过期且在该查询请求之后无人执行查询操作时),则后台服务器将该查询请求转发至第三方服务器,以通过访问第三方服务器获取对应的区域范围内的热点数据,在获取到第三方服务器返回的热点数据之后,后台服务器将该区域范围及对应的热点数据关联之后缓存至缓存区中,并为该热点数据设置过期时间。
具体地,该步骤的实现方式与本申请上述实施例中的步骤S135的实现方式以及步骤“为热点数据设置预设的过期时间;当热点数据存储在缓存区的时间达到过期时间时,将热点数据从缓存区中删除”的实现方式一致,在此不再赘述。
在本申请上述实施例中,在区域范围内发生查询访问的频率未超过预定阈值的情况下,上述的方法还可以包括:通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的对象信息,并缓存区域范围及对应的对象信息至缓存区中;为对象信息设置过期时间,其中,对象信息的过期时间小于热点数据的过期时间。
可选地,在区域范围内发生查询访问的频率未超过预定阈值的情况下,表示该区域范围内聚集的用户不多,该区域范围不被认为是热点地区,因此,当有用户终端向后台服务器发送获取该区域范围内的对象信息的查询请求时,后台服务器将该查询请求转发至第三方服务器,通过访问第三方服务器获得对应的对象信息,为了避免在短期内还有其他用户终端查询该区域范围内的对象信息,后台服务器将获取到的对象信息及对应的区域范围缓存至其缓存区中,并为该对象信息设置较短的过期时间,以免用处不大的缓存数据长期占用后台服务器的存储空间。
继续结合上述的以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,对本申请上述实施例进行说明。当用户位于较偏远的小镇时,若镇内的用户不多,那么当某个用户需要获取其附近的饭店信息时,可以通过手机QQ应用程序将携带有手机当前所在地点的位置信息(如经纬度信息)的查询请求发送至后台服务器,在后台服务器未从缓存区中查询到该手机当前所在地点所属的区域范围之后,将用户的查询请求转发至大众点评网的服务器进行处理,由大众点评网的服务器根据手机当前所在地点确定其所属的区域范围,并将该区域范围内的所有饭店信息(如饭店的名称、距手机当前所在地点的距离、是否有优惠活动以及饭店的具体位置等)返回至后台服务器,后台服务器将大众点评网的服务器返回的对象信息及对应的区域范围(如XX市XX镇XX街道附近500米)关联之后缓存至缓存区中。可选地,在后台服务器将大众点评网的服务器返回的对象信息及对应的区域范围关联并缓存至缓存区中之后,后台服务器为该对象信息设置较短的过期时间,无需长期存储该热点数据,从而避免用处不大的缓存数据长期占用后台服务器的存储空间。
下面结合图3对本申请上述实施例进行说明,如图3所示,以用户终端为智能手机、用户终端上安装的应用程序为手机QQ应用程序的应用场景,以第三方服务器为大众点评网的服务器为例,本申请上述实施例提供了一种可选的技术方案,该方法可以包括如下步骤:
步骤S301,用户通过用户终端发送其所在位置,以发起获取其附近商家的商家信息的查询请求。其中,用户终端可以为智能手机上安装的手机QQ应用程序。
可选地,当智能手机的用户想要获取其附近的饭店信息时,该用户可以通过点击手机QQ应用程序界面中的“动态”,并进一步地选择“动态”中的“吃喝玩乐”选项,在进入“吃喝玩乐”选项的界面之后,选择左上角的“美食”,此时手机QQ应用程序将按照用户选择的选项以及手机的位置信息(如用户所处的具体位置)向后台服务器发送一个查询请求。
步骤S302,后台服务器在接收到用户的查询请求之后,根据用户所在位置在缓存区中查询是否存储有用户所属的区域范围。
具体地,上述步骤S302的实现方式与本申请上述实施例中步骤S131的实现方式一致,在此不再赘述。
其中,在成功查询到存储有用户所属的区域范围时,执行步骤S303;在未查询到存储有用户所属的区域范围时,执行步骤S304。
步骤S303,后台服务器从缓存区中读取该区域范围内的热点数据,并将热点数据返回至智能手机。其中,热点数据可以包括该区域范围内的商家的门店名称、商家距用户终端的距离、商家的所处地理区域信息、商家所在的街道信息、商家的经纬度信息、以及商家是否有优惠活动等等。
可选地,热点数据由用户触发,并在后台为其设置过期时间,过期的热点数据将自动重新构建。
具体地,上述步骤S303的实现方式与本申请上述实施例中步骤S133的实现方式一致,在此不再赘述。
步骤S304,后台服务器将用户的查询请求转发至第三方服务器,以通过访问第三方服务器获取对应的热点数据。其中,第三方服务器可以为大众点评网的服务器。
具体地,上述步骤S304的实现方式与本申请上述实施例中步骤S135的实现方式一致,在此不再赘述。
步骤S305,第三方服务器将对应的热点数据返回至后台服务器。
在上述步骤S305中,可选地,在大众点评网的服务器将对应的热点数据返回至后台服务器之后,后台服务器对该热点数据进行缓存。
其中,在执行步骤S305的过程中,执行步骤S306。
步骤S306,监控第三方服务器的性能。
具体地,上述步骤S305的实现方式与本申请上述实施例中“监控第三方服务器的访问量”的步骤的实现方式一致,在此不再赘述。
可选的,可以通过后台服务器上的商家接口监控装置执行上述步骤S305。
其中,在大众点评网的服务器的性能成为瓶颈时,即大众点评网的服务器处理的访问量(即上述的查询请求量)超过了其处理能力,执行步骤S307。
步骤S307,动态调节区域范围的第一字符串编码长度,并动态调节热点数据的过期时间。其中,第一字符串编码可以为GeoHash字符串。
具体地,根据大众点评网的服务器性能动态调节GeoHash字符串的精度和热点数据的过期时间,通过调节GeoHash字符串长度可以调节区域范围的覆盖范围,从而调节该区域范围内缓存的热点数据的命中率。当后台服务压力比较大,尤其是大众点评网的服务器处理能力成为瓶颈的时候,动态调节GeoHash的长度,扩大区域范围的覆盖范围,由于区域范围的覆盖范围变大,其覆盖的用户数量也变大,从而可以提高该区域范围内的热点数据的命中率。动态调节热点数据的过期时间(如缓存超时失效时间),当大众点评网的服务器处理能力成为瓶颈的时候,监控大众点评网的服务器处理能力并动态调节相应区域范围的热点数据的过期时间,以减小大众 点评网的服务器处理压力。
其中,在执行步骤S306之后,在再次接收到用户发起的查询请求时,返回执行步骤S302。
通过本申请上述实施例,通过GeoHash算法将二维的经纬度数据按一定精度转换成字符串,以表示一定范围的地理位置,采用GeoHash算法对用户附近的商家做缓存,在该范围的其他用户执行查询搜索操作的时候可以命中该缓存,实现了低成本、高效率的缓存,并且,通过动态调整缓存的区域范围和过期时间,减轻了后台服务器和外部合作商家的服务器的压力,为用户提供柔性化服务。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请实施例所必须的。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
可选地,在本实施例中,上述基于位置信息获取数据的方法可以应用于如图13所示的计算机终端A所构成的硬件环境中。如图13所示,计算机终端A通过网络与其他计算机终端进行连接,上述网络包括但不限于:广域网、城域网或局域网。
实施例2
根据本申请实施例,还提供了一种用于实施上述基于位置信息获取数据的方法的基于位置信息获取数据的装置,如图4所示,该装置可以包括:接收单元40、查询单元41以及发送单元42。
其中,接收单元40用于接收用户终端发送的用于获取对象信息的查询请求。其中,查询请求中携带有用户终端的位置信息。
在一个可选的实施例中,后台服务器接收用户终端发送的用于获取对象信息的查询请求。
可选地,用户终端可以为个人计算机或移动终端,如智能手机、笔记本、平板电脑等。可选地,上述的对象可以为用户终端附近的商家,对象信息可以包括商家距用户终端的距离(如小于500米)、商家的所处地理区域信息(如XX市XX区)、商家所在的街道信息、商家的经纬度信息、商家的门店名称以及商家是否有优惠活动等等。
可选地,上述实施例中的商家可以为饭店、电影院、酒店、KTV以及旅游景点等。
进一步可选地,用户终端的位置信息可以包括如下信息中的至少一种:经纬度信息、街道信息、所处地理区域信息、所归属的商圈信息等。
在一个可选的实施例中,在后台服务器接收用户终端发送的查询请求之前,用户终端需要生成相应的查询请求。具体地,可以通过用户终端上安装的应用程序实现生成查询请求。当持有用户终端的用户需要获取对象信息(如,用户需要获取其附近的饭店信息)时,该用户可以通过其用户终端生成携带有用户终端的位置信息的查询请求,然后用户终端将该查询请求发送至后台服务器,后台服务器接收用户终端发送的用于获取对象信息的该查询请求。
可选地,可以通过用户终端上安装的应用程序生成上述的查询请求。
查询单元41用于在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据。其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息。
在一个可选的实施例中,在接收到用户终端发送的查询请求之后,当后台服务器的缓存区非空时,后台服务器从缓存区查询上述的位置信息所在的区域范围内的热点数据。
可选地,区域范围可以为覆盖了预先设置的地理板块的范围,区域范围的热点数据可以包括其覆盖范围内的所有商家的对象信息。
此处需要说明的是,区域范围所覆盖的范围是可以根据需要动态调节的,具体内容将在本申请实施例后续实施例中进行介绍,在此不再详述。
在本申请上述实施例中,热点数据是由用户触发的,当某一区域范围对应的商家信息被查询的次数较高时,缓存区中存储的该区域范围内的商家信息的命中率较高,该区域范围即被认为是热点数据。具体地,当区域范围内发生查询访问的频率超过预定阈值时,即该区域范围内执行查询操作的用户终端的数量较多时,也即该区域范围内聚集的用户较多时,则将该区域范围确定为热点地区,并缓存该热点地区内所包含的所有对象的对象信息作为该区域范围(也即该热点地区)内的热点数据。
可选地,预定阈值可以根据实际应用需求而设定,本申请对此不作具体限定。
根据本申请上述实施例,如图5所示,查询单元41可以包括:查询模块411、读取模块413以及获取模块415。
其中,查询模块411用于从缓存区中查询用户终端的位置信息所在的区域范围。其中,缓存区至少缓存一个预先设置的区域范围,以及区域范围内的热点数据。
具体地,在接收到用户终端发送的查询请求之后,后台服务器检测缓 存区是否非空;当检测到后台服务器的缓存区非空时,根据用户终端的位置信息从缓存区中查询用户终端所处的区域范围。
可选地,后台服务器的缓存区中至少缓存有一个预先设置的区域范围以及该区域范围内的热点数据,其中,区域范围与其内的热点数据具有关联关系。当查询到该区域范围时,即可读取到其内的热点数据。
读取模块413用于在查询成功的情况下,从缓存区中读取区域范围内的热点数据。
具体地,在成功查询到用户终端的位置信息所在的区域范围时,也即查询成功时,从缓存区中读取该区域范围内的热点数据。
获取模块415用于在查询失败的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中。
可选地,在未查询到用户终端的位置信息所在的区域范围时,也即查询失败时,后台服务器需要将用户终端发送的查询请求转发至第三方服务器(如外部合作商家的服务器)处理,通过访问第三服务器来获取用户终端的位置信息所在的区域范围内的热点数据,并将获取到的该区域范围内的热点数据与该区域范围关联之后缓存至后台服务器的缓存区中。
在一个可选的实施例中,当通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中之后,若再次接收到用于获取该区域范围内的对象信息的查询请求,则返回执行查询单元41至发送单元42,其中,在执行查询单元41的过程中,无需再次通过访问第三方服务器获取该区域范围内的热点数据,而可以直接从缓存区中读取该区域范围内的热点数据,从而实现了减轻第三方服务器的处理压力。
可选地,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据可以通过将查询请求转发至第三方服务器的接口(如外 部合作商家的商家接口)实现,由于外部合作商家的商家接口的处理能力有限,因此,通过本申请上述实施例,可以大大缓解商家接口的压力,也即减轻第三方服务器的处理压力。
进一步可选地,在将通过访问第三方服务器获取到的热点数据之后,可以通过第三方服务器直接将获取到的热点数据返回至用户终端,并将该热点数据返回至后台服务器,以供后台服务器将该热点数据及对应的区域范围缓存至缓存区中,也可以在后台服务器完成缓存之后,由后台服务器将该热点数据返回至用户终端。
发送单元42用于将得到的区域范围内的热点数据发送至用户终端。
具体地,在查询得到用户终端的位置信息所在的区域范围内的热点数据之后,将该热点数据返回至用户终端。
采用本申请实施例,在接收到用户终端发送的查询请求之后,根据查询请求中携带的用户终端的位置信息从缓存区中查询该位置信息所在的区域范围内的热点数据,实现向用户终端发送其所在区域范围内的对象信息。在本申请实施例中,通过在缓存区中存储聚集用户较多的区域范围的热点数据(如商家信息),可以保证大多数用户在获取附近商家信息时可以从缓存区中查询到对应的热点数据,如偏远地点无用户执行查询操作时,则不缓存该偏远地点的商家信息,无需现有技术中按照固定的范围将全国覆盖的地理板块切分并在切分之后缓存每个板块内的所有商家信息,即无需全量存储全国各个板块内的所有商家信息,减小了所需的存储空间,降低了后台服务器的存储压力。通过本申请实施例,解决了现有技术中在根据经纬度搜索附近的商家信息时,在后台服务器中需要缓存所有的商家信息,导致占用较大的存储空间的技术问题,实现了减小占用后台服务器的存储空间,降低后台服务器的存储压力的效果。
在本申请上述实施例中,如图6所示,获取模块415可以包括:第一转化子模块4151和缓存子模块4153。
其中,第一转化子模块用于将用于表示区域范围的二维经纬度数据转化为一维的第一字符串编码。
具体地,在通过访问第三方服务器获取到用户终端的位置信息所在的区域范围内的热点数据之后,后台服务器将用于表示该区域范围的二维经纬度数据转化为一维的第一字符串编码。
在一个可选的实施例中,可以通过GeoHash算法将二维的经纬度数据转化为一个可排序、可比较的一维的字符串编码,每一个字符串编码表示某一区域范围。其中,当GeoHash字符串编码长度越长时,其所表示的区域范围的精度越高,例如GeoHash字符串编码长度为8时,其所表示的区域范围的精度在19米左右,而当GeoHash字符串编码长度为9时,其所表示的区域范围的精度在2米左右,字符串编码的长度需要根据数据情况进行选择。
缓存子模块用于将第一字符串编码和获取到的区域范围内的热点数据关联之后缓存至缓存区。
具体地,在后台服务器将用于表示该区域范围的二维经纬度数据转化为一维的第一字符串编码之后,将该第一字符串编码和获取到的该区域范围内的热点数据关联之后,再缓存至后台服务器的缓存区。
此处需要进一步说明的是,GeoHash字符串相似的则表示距离相近,这样可以利用GeoHash字符串的前缀匹配来查询附近的商家信息。
通过本申请上述实施例,由于将二维的经纬度数据转化为一维的第一字符串编码,可根据区域范围内发生查询访问的频率方便地通过调整该第一字符串编码的长度,实现调节该第一字符串编码所表示的区域范围,也即可方便地调节区域范围所覆盖的地理范围,解决了现有技术中按照固定的范围切分板块,当板块的大小有更新时,更新操作繁琐,更新效率低的问题,实现了可方便快速的动态调节区域范围的大小。
根据本申请上述实施例,如图7所示,查询模块411可以包括:第二 转化子模块4111、查询子模块4113、第一确定子模块4115以及第二确定子模块4117。
其中,第二转化子模块用于将用户终端的位置信息中的经纬度数据转化为缓存区可识别的第二字符串编码。
具体地,在后台服务器的缓存区非空时,将接收到的查询请求中携带的用户终端的位置信息中的经纬度数据转化为缓存区可识别的第二字符串编码。
查询子模块用于在缓存区中查询是否存储有与第二字符串编码相同的第一字符串编码。
具体地,在后台服务器的缓存区中查询是否存储有与第二字符串编码相同的第一字符串编码。
可选地,当用户终端的经纬度数据落在某一区域范围内时,该用户终端的经纬度数据经GeoHash算法转化得到的GeoHash字符串(即上述的第二字符串编码)与用于表示该区域范围的经纬度数据经GeoHash算法转化得到的GeoHash字符串(即上述的第一字符串编码)相同,若在缓存区中查询到与第二字符串编码相同的第一字符串编码,则表示缓存区中存储有该区域范围的热点数据,此时确定成功查询到了区域范围;若在缓存区中未查询到与第二字符串编码相同的第一字符串编码,则表示缓存区中没有存储该区域范围的热点数据,此时确定查询区域范围失败。
第一确定子模块用于在缓存区中存储有与第二字符串编码相同的第一字符串编码的情况下,确定成功查询到区域范围。
具体地,在成功查询到区域范围的情况下,从缓存区中读取该区域范围内的热点数据,该第一确定子模块的实现方式与上述实施例中的读取模块413的实现方式一致,在此不再赘述。
第二确定子模块用于在缓存区中未存储与第二字符串编码相同的第一字符串编码的情况下,确定查询区域范围失败。
具体地,在查询区域范围失败的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中,该第二确定子模块的实现方式与上述实施例中的获取模块415的实现方式一致,在此不再赘述。
通过本申请上述实施例,根据用户终端所在位置查询其附近的商家信息时,只需要将用户终端所在位置的经纬度数据转换成一维的GeoHash字符串,并与缓存区中存储的各个区域范围的GeoHash字符串进行前缀匹配,当区域范围的GeoHash字符串与用户终端所在位置的GeoHash字符串相同时,即可确定缓存区中存储有用户终端所在位置所处的区域范围,查询方便快捷、查询效率高。
在本申请上述实施例中,如图8所示,上述的装置还可以包括:第一设置单元43和删除单元44。
其中,第一设置单元用于在将第一字符串编码和获取到的区域范围内的热点数据关联之后缓存至缓存区的同时或之后,为热点数据设置预设的过期时间。其中,过期时间根据热点数据被查询的频率确定。
删除单元用于当热点数据存储在缓存区的时间达到过期时间时,将热点数据从缓存区中删除。
具体地,当将通过第三方服务器获取到的热点数据与用于表示对应的区域范围的第一字符串关联缓存至缓存区的同时或之后,为该热点数据设置预设的过期时间,并在热点数据存储于缓存区的时间达到该过期时间时,将热点数据从缓存区中删除,达到及时更新热点数据的效果。
在一个可选的实施例中,当某一区域范围内的热点数据达到其过期时间并被删除之后,若后台服务器再次接收到用于获取该区域范围内的对象信息的查询请求,则需要返回执行上述接收单元40至发送单元42,此时,由于后台服务器中没有存储该区域范围内的热点数据,则需要通过访问第三方服务器来获取相应的热点数据。因此,过期时间的长短关系到第三方 服务器的处理压力,若过期时间偏短,那么第三方服务器需要多次处理用户终端的查询请求,而导致第三方服务器的处理能力成为整个系统的瓶颈,影响查询效率,无法及时处理用户终端发送的查询请求,导致用户等待时间长,用户体验差;过期时间偏长则可能导致无法及时更新区域范围内的商家信息。
可选地,过期时间可以根据热点数据被查询的频率确定,也即根据热点数据的命中率确定。
需要进一步说明的是,在本申请实施例中,当用户终端发送的查询请求是请求获取某一区域范围内的对象信息时,缓存区存储有该区域范围内的热点数据,则此时称为命中该热点数据,命中该热点数据的次数越多,则表示该热点数据的命中率越高。
在一个可选的实施例中,当某一区域范围内的一家或多家商家进行优惠活动时,可能会在短期内吸引较多的用户在该区域范围内执行查询操作,此时,可以为该区域范围内的热点数据设置较长的过期时间,如1天或2天,以避免该区域内的热点数据在短时间内重复更新,导致后台服务器和第三方服务器的处理压力大。
通过本申请上述实施例,为热点数据设置过期时间可以保证及时有效地更新对应的区域范围内的商家信息,以为用户提供最新的商家信息,如在新增商家或者新增商家优惠活动时,可以及时向用户提供相关信息。
在本申请上述实施例中,如图9所示,上述的装置还可以包括:第一监控单元45、调整单元46以及第一获取单元47。
其中,第一监控单元用于在从缓存区中查询用户终端的位置信息所在的区域范围的过程中,监控从缓存区中查询同一个区域范围的查询次数。
调整单元用于在监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,调整第一字符串编码的精度以扩大被查询的区域范围的覆盖范围,得到调整后的区域范围。
第一获取单元用于在接收到用于获取调整后的区域范围内的对象信息的查询请求之后,通过访问第三方服务器获取调整后的区域范围内的热点数据,并缓存调整后的区域范围及对应的热点数据至缓存区中。
可选地,对从缓存区中查询相同的区域范围的查询次数进行监控,也即监控缓存区中的各个热点数据的命中率,当监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,表示该区域范围内的有较多的用户在执行查询操作,若在该区域范围外部边缘处也有较多的用户在查询对象信息,则该外部边缘处的用户们将不会命中该区域范围内的热点数据,此时可能导致第三方服务器的处理压力过大,无法及时处理用户终端发送的查询请求,导致用户等待的时间久,用户体验差,因此,在监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,可以通过缩短第一字符串编码的长度来降低第一字符串编码的精度,从而扩大被查询的区域范围的覆盖范围,得到调整后的区域范围。其中,该调整后的区域范围可以覆盖更大的地理范围。
进一步地,在得到调整后的区域范围之后,在接收到用于获取该调整后的区域范围内的对象信息的查询请求之后,通过访问第三方服务器获取调整后的区域范围的热点数据,并将该调整后的区域范围及对应的热点数据关联之后缓存至缓存区中,其具体实现方式与上述实施例中获取模块415的实现方式一致,在此不再赘述。
在一个可选的实施例中,在通过访问第三方服务器获取该调整后的区域范围内的热点数据,并将该调整后的区域范围及对应的热点数据关联之后缓存至缓存区中之后,若再次接收到用于获取该调整后的区域范围内的对象信息的查询请求,则返回执行查询单元41至发送单元42,其中,在执行查询单元41的过程中,无需再次通过访问第三方服务器获取该区域范围内的热点数据,而可以直接从缓存区中读取该区域范围内的热点数据,从而实现了减轻第三方服务器的处理压力。
可选地,通过访问第三方服务器获取调整后的区域范围内的热点数据 可以通过将查询请求转发至第三方服务器的接口(如外部合作商家的商家接口)实现,由于外部合作商家的商家接口的处理能力有限,因此,通过本申请上述实施例,可以大大缓解商家接口的压力,减轻第三方服务器的处理压力。
根据本申请上述实施例,如图10所示,上述的装置还可以包括:第二监控单元48和延长单元49。
其中,第二监控单元用于在通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据的过程中,监控第三方服务器的访问量。
延长单元用于在第三方服务器的访问量超过预设访问阈值的情况下,根据访问量延长热点数据的过期时间。
可选地,在通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据的过程中,由于第三方服务器的处理能力有限,为了避免第三方服务器的处理能力导致系统处理瓶颈,避免用户长时间等待而降低用户体验,需要对第三方服务器的访问量进行监控,也即监控第三方服务器处理的查询请求的数量,当监控到第三方服务器的访问量超过预设访问阈值时,可以认为此时第三方服务器的处理能力已到极限,无法继续及时处理其他的查询请求,为了缓解第三方服务器的压力,可以根据访问量的大小而延长相应热点数据的过期时间,通过避免热点数据在短时间内重复更新,而降低第三方服务器的处理压力。
根据本申请上述实施例,如图11所示,上述的装置还可以包括:第二获取单元50和第二设置单元51。
其中,第二获取单元用于在缓存区为空的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中。
第二设置单元用于为热点数据设置过期时间。
可选地,在接收到用户终端发送的用户获取对象信息的查询请求之后,若后台服务器检测缓存区为空(如系统刚开始运行时或者后台服务器内缓存的热点数据全部过期且在该查询请求之后无人执行查询操作时),则后台服务器将该查询请求转发至第三方服务器,以通过访问第三方服务器获取对应的区域范围内的热点数据,在获取到第三方服务器返回的热点数据之后,后台服务器将该区域范围及对应的热点数据关联之后缓存至缓存区中,并为该热点数据设置过期时间。
具体地,上述实施例的实现方式与本申请上述实施例中的获取模块415的实现方式以及第一设置单元和删除单元的实现方式一致,在此不再赘述。
在本申请上述实施例中,如图12所示,上述的装置还可以包括:第三获取单元52和第三设置单元53。
第三获取单元用于在区域范围内发生查询访问的频率超过预定阈值的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的对象信息,并缓存区域范围及对应的对象信息至缓存区中。
第三设置单元用于为对象信息设置过期时间,其中,对象信息的过期时间小于热点数据的过期时间。
可选地,在区域范围内发生查询访问的频率未超过预定阈值的情况下,表示该区域范围内聚集的用户不多,该区域范围不被认为是热点地区,因此,当有用户终端向后台服务器发送获取该区域范围内的对象信息的查询请求时,后台服务器将该查询请求转发至第三方服务器,通过访问第三方服务器获得对应的对象信息,为了避免在短期内还有其他用户终端查询该区域范围内的对象信息,后台服务器将获取到的对象信息及对应的区域范围缓存至其缓存区中,并为该对象信息设置较短的过期时间,以免用处不大的缓存数据长期占用后台服务器的存储空间。
可选地,在本实施例中,上述基于位置信息获取数据的装置可以应用 于如图13所示的计算机终端A所构成的硬件环境中。如图13所示,计算机终端A通过网络与其他计算机终端进行连接,上述网络包括但不限于:广域网、城域网或局域网。
实施例3
本申请的实施例可以提供一种计算机终端,该计算机终端可以是计算机终端群中的任意一个计算机终端设备。可选地,在本实施例中,上述计算机终端也可以替换为移动终端等终端设备。
可选地,在本实施例中,上述计算机终端可以位于计算机网络的多个网络设备中的至少一个网络设备。
可选地,图13是根据本申请实施例的一种计算机终端的结构框图。如图13所示,该计算机终端A可以包括:一个或多个(图中仅示出一个)处理器61、存储器63、以及传输装置65。
其中,存储器63可用于存储软件程序以及模块,如本申请实施例中的基于位置信息获取数据的方法和装置对应的程序指令/模块,处理器61通过运行存储在存储器63内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的基于位置信息获取数据的方法。存储器63可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器63可进一步包括相对于处理器61远程设置的存储器,这些远程存储器可以通过网络连接至终端A。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
上述的传输装置66用于经由一个网络接收或者发送数据。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置66包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置66为射频(Radio Frequency,RF)模块,其用于通过无 线方式与互联网进行通讯。
其中,具体地,存储器63用于存储预设动作条件和预设权限用户的信息、以及应用程序。
处理器61可以通过传输装置调用存储器63存储的信息及应用程序,以执行下述步骤:接收用户终端发送的用于获取对象信息的查询请求,其中,查询请求中携带有用户终端的位置信息;在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据,其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息;将得到的区域范围内的热点数据发送至用户终端。
可选的,上述处理器61还可以执行如下步骤的程序代码:从缓存区中查询用户终端的位置信息所在的区域范围,其中,缓存区至少缓存一个预先设置的区域范围,以及区域范围内的热点数据;在查询成功的情况下,从缓存区中读取区域范围内的热点数据;在查询失败的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中。
可选的,上述处理器61还可以执行如下步骤的程序代码:将用于表示区域范围的二维经纬度数据转化为一维的第一字符串编码;将第一字符串编码和获取到的区域范围内的热点数据关联之后缓存至缓存区。
可选的,上述处理器61还可以执行如下步骤的程序代码:将用户终端的位置信息中的经纬度数据转化为缓存区可识别的第二字符串编码;在缓存区中查询是否存储有与第二字符串编码相同的第一字符串编码;若在缓存区中存储有与第二字符串编码相同的第一字符串编码,则确定成功查询到区域范围;若在缓存区中未存储与第二字符串编码相同的第一字符串编码,则确定查询区域范围失败。
可选的,上述处理器61还可以执行如下步骤的程序代码:为热点数 据设置预设的过期时间,其中,过期时间根据热点数据被查询的频率确定;当热点数据存储在缓存区的时间达到过期时间时,将热点数据从缓存区中删除。
可选的,上述处理器61还可以执行如下步骤的程序代码:监控从缓存区中查询同一个区域范围的查询次数;在监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,调整第一字符串编码的精度以扩大被查询的区域范围的覆盖范围,得到调整后的区域范围;在接收到用于获取调整后的区域范围内的对象信息的查询请求之后,通过访问第三方服务器获取调整后的区域范围内的热点数据,并缓存调整后的区域范围及对应的热点数据至缓存区中。
可选的,上述处理器61还可以执行如下步骤的程序代码:监控第三方服务器的访问量;在第三方服务器的访问量超过预设访问阈值的情况下,根据访问量延长热点数据的过期时间。
可选的,上述处理器61还可以执行如下步骤的程序代码:通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中;为热点数据设置过期时间。
可选的,上述处理器61还可以执行如下步骤的程序代码:通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的对象信息,并缓存区域范围及对应的对象信息至缓存区中;为对象信息设置过期时间,其中,对象信息的过期时间小于热点数据的过期时间。
本领域普通技术人员可以理解,图13所示的结构仅为示意,计算机终端也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌声电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图13其并不对上述电子装置的结构造成限定。例如,计算机终端10还可包括比图13中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图13所示不同的配置。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
可选地,本实施例中的具体示例可以参考上述实施例1和实施例2中所描述的示例,本实施例在此不再赘述。
实施例4
本申请的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以存储上述实施例一的基于位置信息获取数据的方法的程序代码。
可选地,在本实施例中,上述存储介质902可以位于计算机网络中的多个网络设备中的至少一个网络设备。
可选地,在本实施例中,存储介质902被设置为存储用于执行以下步骤的程序代码:接收用户终端发送的用于获取对象信息的查询请求,其中,查询请求中携带有用户终端的位置信息;在缓存区非空的情况下,从缓存区中查询用户终端的位置信息所在的区域范围内的热点数据,其中,热点数据为当区域范围内发生查询访问的频率超过预定阈值时,缓存的区域范围内所包含的对象的信息;将得到的区域范围内的热点数据发送至用户终端。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:从缓存区中查询用户终端的位置信息所在的区域范围,其中,缓存区至少缓存一个预先设置的区域范围,以及区域范围内的热点数据;在查询成功的情况下,从缓存区中读取区域范围内的热点数据;在查询失败的情况下,通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:将用于表示区域范围的二维经纬度数据转化为一维的第一字符串编码;将第一字符串编码和获取到的区域范围内的热点数据关联之后缓存至缓存区。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:将用户终端的位置信息中的经纬度数据转化为缓存区可识别的第二字符串编码;在缓存区中查询是否存储有与第二字符串编码相同的第一字符串编码;若在缓存区中存储有与第二字符串编码相同的第一字符串编码,则确定成功查询到区域范围;若在缓存区中未存储与第二字符串编码相同的第一字符串编码,则确定查询区域范围失败。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:为热点数据设置预设的过期时间,其中,过期时间根据热点数据被查询的频率确定;当热点数据存储在缓存区的时间达到过期时间时,将热点数据从缓存区中删除。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:监控从缓存区中查询同一个区域范围的查询次数;在监控到从缓存区中查询同一个区域范围的查询次数超过预设查询阈值时,调整第一字符串编码的精度以扩大被查询的区域范围的覆盖范围,得到调整后的区域范围;在接收到用于获取调整后的区域范围内的对象信息的查询请求之后,通过访问第三方服务器获取调整后的区域范围内的热点数据,并缓存调整后的区域范围及对应的热点数据至缓存区中。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:监控第三方服务器的访问量;在第三方服务器的访问量超过预设访问阈值的情况下,根据访问量延长热点数据的过期时间。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的热点数据,并缓存区域范围及对应的热点数据至缓存区中;为热点数据设置过期时间。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:通过访问第三方服务器获取用户终端的位置信息所在的区域范围内的对象信息,并缓存区域范围及对应的对象信息至缓存区中;为对象信息设置过期时间,其中,对象信息的过期时间小于热点数据的过期时间。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,本实施例中的具体示例可以参考上述实施例1和实施例2中所描述的示例,本实施例在此不再赘述。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或 通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上所述仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。

Claims (27)

  1. 一种基于位置信息获取数据的方法,包括:
    接收用户终端发送的用于获取对象信息的查询请求,其中,所述查询请求中携带有所述用户终端的位置信息;
    在缓存区非空的情况下,从所述缓存区中查询所述用户终端的位置信息所在的区域范围内的热点数据,其中,所述热点数据为当所述区域范围内发生查询访问的频率超过预定阈值时,缓存的所述区域范围内所包含的对象的信息;
    将得到的所述区域范围内的热点数据发送至所述用户终端。
  2. 根据权利要求1所述的方法,其中,从所述缓存区中查询所述用户终端的位置信息所在的区域范围内的热点数据,包括:
    从所述缓存区中查询所述用户终端的位置信息所在的所述区域范围,其中,所述缓存区至少缓存一个预先设置的区域范围,以及所述区域范围内的热点数据;
    在查询成功的情况下,从所述缓存区中读取所述区域范围内的热点数据;
    在查询失败的情况下,通过访问第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据,并缓存所述区域范围及对应的所述热点数据至所述缓存区中。
  3. 根据权利要求2所述的方法,其中,缓存所述区域范围及对应的所述热点数据至所述缓存区中包括:
    将用于表示所述区域范围的二维经纬度数据转化为一维的第一字符串编码;
    将所述第一字符串编码和获取到的所述区域范围内的热点数据关联之后缓存至所述缓存区。
  4. 根据权利要求3所述的方法,其中,从所述缓存区中查询所述用户终 端的位置信息所在的所述区域范围包括:
    将所述用户终端的位置信息中的经纬度数据转化为所述缓存区可识别的第二字符串编码;
    在所述缓存区中查询是否存储有与所述第二字符串编码相同的所述第一字符串编码;
    若在所述缓存区中存储有与所述第二字符串编码相同的所述第一字符串编码,则确定成功查询到所述区域范围;
    若在所述缓存区中未存储与所述第二字符串编码相同的所述第一字符串编码,则确定查询所述区域范围失败。
  5. 根据权利要求3所述的方法,其中,在将所述第一字符串编码和获取到的所述区域范围内的热点数据关联之后缓存至所述缓存区的同时或之后,所述方法还包括:
    为所述热点数据设置预设的过期时间,其中,所述过期时间根据所述热点数据被查询的频率确定;
    当所述热点数据存储在所述缓存区的时间达到所述过期时间时,将所述热点数据从所述缓存区中删除。
  6. 根据权利要求3所述的方法,其中,在从所述缓存区中查询所述用户终端的位置信息所在的所述区域范围的过程中,所述方法还包括:
    监控从所述缓存区中查询同一个所述区域范围的查询次数;
    在监控到从所述缓存区中查询同一个所述区域范围的查询次数超过预设查询阈值时,调整所述第一字符串编码的精度以扩大被查询的所述区域范围的覆盖范围,得到调整后的区域范围;
    在接收到用于获取所述调整后的区域范围内的对象信息的查询请求之后,通过访问所述第三方服务器获取所述调整后的区域范围内的热点数据,并缓存所述调整后的区域范围及对应的所述热点数据至所述缓存区中。
  7. 根据权利要求5所述的方法,其中,在通过访问第三方服务器获取所 述用户终端的位置信息所在的所述区域范围内的热点数据的过程中,所述方法还包括:
    监控所述第三方服务器的访问量;
    在所述第三方服务器的访问量超过预设访问阈值的情况下,根据所述访问量延长所述热点数据的过期时间。
  8. 根据权利要求5所述的方法,其中,在所述缓存区为空的情况下,所述方法还包括:
    通过访问所述第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据,并缓存所述区域范围及对应的所述热点数据至所述缓存区中;
    为所述热点数据设置所述过期时间。
  9. 根据权利要求5所述的方法,其中,在所述区域范围内发生查询访问的频率未超过所述预定阈值的情况下,所述方法还包括:
    通过访问所述第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的对象信息,并缓存所述区域范围及对应的所述对象信息至所述缓存区中;
    为所述对象信息设置所述过期时间,其中,所述对象信息的过期时间小于所述热点数据的过期时间。
  10. 一种基于位置信息获取数据的装置,包括:
    接收单元,用于接收用户终端发送的用于获取对象信息的查询请求,其中,所述查询请求中携带有所述用户终端的位置信息;
    查询单元,用于在缓存区非空的情况下,从所述缓存区中查询所述用户终端的位置信息所在的区域范围内的热点数据,其中,所述热点数据为当所述区域范围内发生查询访问的频率超过预定阈值时,缓存的所述区域范围内所包含的对象的信息;
    发送单元,用于将得到的所述区域范围内的热点数据发送至所述用户终端。
  11. 根据权利要求10所述的装置,其中,所述查询单元包括:
    查询模块,用于从所述缓存区中查询所述用户终端的位置信息所在的所述区域范围,其中,所述缓存区至少缓存一个预先设置的区域范围,以及所述区域范围内的热点数据;
    读取模块,用于在查询成功的情况下,从所述缓存区中读取所述区域范围内的热点数据;
    获取模块,用于在查询失败的情况下,通过访问第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据,并缓存所述区域范围及对应的所述热点数据至所述缓存区中。
  12. 根据权利要求11所述的装置,其中,所述获取模块包括:
    第一转化子模块,用于将用于表示所述区域范围的二维经纬度数据转化为一维的第一字符串编码;
    缓存子模块,用于将所述第一字符串编码和获取到的所述区域范围内的热点数据关联之后缓存至所述缓存区。
  13. 根据权利要求12所述的装置,其中,所述查询模块包括:
    第二转化子模块,用于将所述用户终端的位置信息中的经纬度数据转化为所述缓存区可识别的第二字符串编码;
    查询子模块,用于在所述缓存区中查询是否存储有与所述第二字符串编码相同的所述第一字符串编码;
    第一确定子模块,用于在所述缓存区中存储有与所述第二字符串编码相同的所述第一字符串编码的情况下,确定成功查询到所述区域范围;
    第二确定子模块,用于在所述缓存区中未存储与所述第二字符串编码相同的所述第一字符串编码的情况下,确定查询所述区域范围失败。
  14. 根据权利要求12所述的装置,其中,所述装置还包括:
    第一设置单元,用于在将所述第一字符串编码和获取到的所述区域范围内的热点数据关联之后缓存至所述缓存区的同时或之后,为所述热点数据设置预设的过期时间,其中,所述过期时间根据所述热点数据被查询的频率确定;
    删除单元,用于当所述热点数据存储在所述缓存区的时间达到所述过期时间时,将所述热点数据从所述缓存区中删除。
  15. 根据权利要求12所述的装置,其中,所述装置还包括:
    第一监控单元,用于在从所述缓存区中查询所述用户终端的位置信息所在的所述区域范围的过程中,监控从所述缓存区中查询同一个所述区域范围的查询次数;
    调整单元,用于在监控到从所述缓存区中查询同一个所述区域范围的查询次数超过预设查询阈值时,调整所述第一字符串编码的精度以扩大被查询的所述区域范围的覆盖范围,得到调整后的区域范围;
    第一获取单元,用于在接收到用于获取所述调整后的区域范围内的对象信息的查询请求之后,通过访问所述第三方服务器获取所述调整后的区域范围内的热点数据,并缓存所述调整后的区域范围及对应的所述热点数据至所述缓存区中。
  16. 根据权利要求14所述的装置,其中,所述装置还包括:
    第二监控单元,用于在通过访问第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据的过程中,监控所述第三方服务器的访问量;
    延长单元,用于在所述第三方服务器的访问量超过预设访问阈值的情况下,根据所述访问量延长所述热点数据的过期时间。
  17. 根据权利要求14所述的装置,其中,所述装置还包括:
    第二获取单元,用于在所述缓存区为空的情况下,通过访问所述第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据,并缓存所述区域范围及对应的所述热点数据至所述缓存 区中;
    第二设置单元,用于为所述热点数据设置所述过期时间。
  18. 根据权利要求14所述的装置,其中,所述装置还包括:
    第三获取单元,用于在所述区域范围内发生查询访问的频率未超过所述预定阈值的情况下,通过访问所述第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的对象信息,并缓存所述区域范围及对应的所述对象信息至所述缓存区中;
    第三设置单元,用于为所述对象信息设置所述过期时间,其中,所述对象信息的过期时间小于所述热点数据的过期时间。
  19. 一种存储介质,所述存储介质被设置为存储用于执行以下步骤的程序代码,包括:
    接收用户终端发送的用于获取对象信息的查询请求,其中,所述查询请求中携带有所述用户终端的位置信息;
    在缓存区非空的情况下,从所述缓存区中查询所述用户终端的位置信息所在的区域范围内的热点数据,其中,所述热点数据为当所述区域范围内发生查询访问的频率超过预定阈值时,缓存的所述区域范围内所包含的对象的信息;
    将得到的所述区域范围内的热点数据发送至所述用户终端。
  20. 根据权利要求19所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    从所述缓存区中查询所述用户终端的位置信息所在的所述区域范围,其中,所述缓存区至少缓存一个预先设置的区域范围,以及所述区域范围内的热点数据;
    在查询成功的情况下,从所述缓存区中读取所述区域范围内的热点数据;
    在查询失败的情况下,通过访问第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据,并缓存所述区域范围 及对应的所述热点数据至所述缓存区中。
  21. 根据权利要求20所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    将用于表示所述区域范围的二维经纬度数据转化为一维的第一字符串编码;
    将所述第一字符串编码和获取到的所述区域范围内的热点数据关联之后缓存至所述缓存区。
  22. 根据权利要求21所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    将所述用户终端的位置信息中的经纬度数据转化为所述缓存区可识别的第二字符串编码;
    在所述缓存区中查询是否存储有与所述第二字符串编码相同的所述第一字符串编码;
    若在所述缓存区中存储有与所述第二字符串编码相同的所述第一字符串编码,则确定成功查询到所述区域范围;
    若在所述缓存区中未存储与所述第二字符串编码相同的所述第一字符串编码,则确定查询所述区域范围失败。
  23. 根据权利要求21所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    为所述热点数据设置预设的过期时间,其中,所述过期时间根据所述热点数据被查询的频率确定;
    当所述热点数据存储在所述缓存区的时间达到所述过期时间时,将所述热点数据从所述缓存区中删除。
  24. 根据权利要求21所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    监控从所述缓存区中查询同一个所述区域范围的查询次数;
    在监控到从所述缓存区中查询同一个所述区域范围的查询次数超过预设查询阈值时,调整所述第一字符串编码的精度以扩大被查询的所述区域范围的覆盖范围,得到调整后的区域范围;
    在接收到用于获取所述调整后的区域范围内的对象信息的查询请求之后,通过访问所述第三方服务器获取所述调整后的区域范围内的热点数据,并缓存所述调整后的区域范围及对应的所述热点数据至所述缓存区中。
  25. 根据权利要求23所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    监控所述第三方服务器的访问量;
    在所述第三方服务器的访问量超过预设访问阈值的情况下,根据所述访问量延长所述热点数据的过期时间。
  26. 根据权利要求23所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    通过访问所述第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的热点数据,并缓存所述区域范围及对应的所述热点数据至所述缓存区中;
    为所述热点数据设置所述过期时间。
  27. 根据权利要求23所述的存储介质,所述存储介质还被设置为存储用于执行以下步骤的程序代码,包括:
    通过访问所述第三方服务器获取所述用户终端的位置信息所在的所述区域范围内的对象信息,并缓存所述区域范围及对应的所述对象信息至所述缓存区中;
    为所述对象信息设置所述过期时间,其中,所述对象信息的过期时间小于所述热点数据的过期时间。
PCT/CN2016/091947 2015-08-03 2016-07-27 基于位置信息获取数据的方法和装置 WO2017020765A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/571,082 US11144609B2 (en) 2015-08-03 2016-07-27 Method and apparatus for obtaining data based on location information

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510482174.0A CN106708833B (zh) 2015-08-03 2015-08-03 基于位置信息获取数据的方法和装置
CN201510482174.0 2015-08-03

Publications (1)

Publication Number Publication Date
WO2017020765A1 true WO2017020765A1 (zh) 2017-02-09

Family

ID=57942413

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/091947 WO2017020765A1 (zh) 2015-08-03 2016-07-27 基于位置信息获取数据的方法和装置

Country Status (3)

Country Link
US (1) US11144609B2 (zh)
CN (1) CN106708833B (zh)
WO (1) WO2017020765A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110637292A (zh) * 2017-05-19 2019-12-31 甲骨文国际公司 用于查询资源高速缓存的系统和方法
CN110889042A (zh) * 2019-11-26 2020-03-17 北京梧桐车联科技有限责任公司 资源推荐方法、装置、计算机设备及存储介质
CN112559570A (zh) * 2020-12-16 2021-03-26 中国平安财产保险股份有限公司 缓存数据获取方法、装置、设备及存储介质

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6308093B2 (ja) * 2014-10-07 2018-04-11 株式会社デンソー 情報取得システム、通信端末、情報取得プログラム及び記憶媒体
CN108984553B (zh) * 2017-06-01 2022-02-01 北京京东尚科信息技术有限公司 缓存方法和装置
CN107301215B (zh) * 2017-06-09 2020-12-18 北京奇艺世纪科技有限公司 一种搜索结果缓存方法及装置、搜索方法及装置
CN107885873B (zh) * 2017-11-28 2021-08-24 百度在线网络技术(北京)有限公司 用于输出信息的方法和装置
CN108376157B (zh) * 2018-02-08 2022-06-07 腾讯科技(深圳)有限公司 目标用户查询方法、系统和装置
CN110069419A (zh) * 2018-09-04 2019-07-30 中国平安人寿保险股份有限公司 多级缓存系统及其访问控制方法、设备和存储介质
CN111767352A (zh) * 2019-09-27 2020-10-13 北京京东尚科信息技术有限公司 信息获取方法、装置、lbs系统以及存储介质
CN110765222B (zh) * 2019-10-24 2022-04-19 成都路行通信息技术有限公司 一种基于Geohash编码的兴趣点自驾热度计算方法和平台
CN111897902A (zh) * 2020-07-14 2020-11-06 西安润森数码网络科技有限责任公司 基于lbs和gis的精准定位方法、装置及存储介质
CN112487326B (zh) * 2020-11-27 2024-03-19 杭州安恒信息技术股份有限公司 数据缓存方法、系统、存储介质及设备
CN112507199B (zh) * 2020-12-22 2022-02-25 北京百度网讯科技有限公司 用于对搜索系统进行优化的方法和装置
CN112948674A (zh) * 2021-02-26 2021-06-11 平安科技(深圳)有限公司 基于Redis的智能推送服务的方法、装置及计算机设备
CN113763051A (zh) * 2021-09-08 2021-12-07 北京房江湖科技有限公司 门店到访信息确定方法、装置及存储介质
CN114880421B (zh) * 2022-07-08 2022-10-18 北谷电子有限公司 位置服务方法、系统、电子设备和存储介质
CN115996227A (zh) * 2022-12-23 2023-04-21 中国联合网络通信集团有限公司 数据共享方法、装置、系统、服务器及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023946A (zh) * 2011-09-26 2013-04-03 北京千橡网景科技发展有限公司 用于在社交网络中推荐共同兴趣场所的方法和设备
CN103020125A (zh) * 2012-11-19 2013-04-03 百度国际科技(深圳)有限公司 提供服务资源的方法、输入的方法及服务器、电子设备
CN103246679A (zh) * 2012-02-13 2013-08-14 刘龙 一种实现基于位置的搜索的系统和方法
US20140297415A1 (en) * 2007-07-03 2014-10-02 Vulcan, Inc. Method and system for continuous, dynamic, adaptive recommendation based on a continuously evolving personal region of interest

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7346360B1 (en) * 2005-08-03 2008-03-18 At&T Mobility Ii Llc Location caching with expiration based on location
US8943043B2 (en) * 2010-01-24 2015-01-27 Microsoft Corporation Dynamic community-based cache for mobile search
US9177069B1 (en) * 2011-05-19 2015-11-03 Google Inc. Determining labels from similar geographic features
CN103686860A (zh) * 2011-07-15 2014-03-26 上海华为技术有限公司 缓存数据的分布缓存方法和装置
KR101584329B1 (ko) * 2011-08-16 2016-01-21 엠파이어 테크놀로지 디벨롭먼트 엘엘씨 복수 개의 저장 장치로 데이터의 할당
US8983953B2 (en) * 2011-10-18 2015-03-17 Nokia Corporation Methods and apparatuses for facilitating interaction with a geohash-indexed data set
CN102523279B (zh) * 2011-12-12 2015-09-23 深圳市安云信息科技有限公司 一种分布式文件系统及其热点文件存取方法
CN103177005B (zh) * 2011-12-21 2016-08-03 深圳市腾讯计算机系统有限公司 一种数据访问的处理方法和系统
US9510141B2 (en) * 2012-06-04 2016-11-29 Apple Inc. App recommendation using crowd-sourced localized app usage data
CN103944958A (zh) * 2014-03-14 2014-07-23 中国科学院计算技术研究所 一种广域文件系统及实现方法
CN104135715B (zh) * 2014-06-10 2015-10-07 腾讯科技(深圳)有限公司 一种位置服务的实现方法、装置,及系统
WO2015195923A1 (en) * 2014-06-21 2015-12-23 Google Inc. Tile-based distribution of searchable geospatial data to client devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140297415A1 (en) * 2007-07-03 2014-10-02 Vulcan, Inc. Method and system for continuous, dynamic, adaptive recommendation based on a continuously evolving personal region of interest
CN103023946A (zh) * 2011-09-26 2013-04-03 北京千橡网景科技发展有限公司 用于在社交网络中推荐共同兴趣场所的方法和设备
CN103246679A (zh) * 2012-02-13 2013-08-14 刘龙 一种实现基于位置的搜索的系统和方法
CN103020125A (zh) * 2012-11-19 2013-04-03 百度国际科技(深圳)有限公司 提供服务资源的方法、输入的方法及服务器、电子设备

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110637292A (zh) * 2017-05-19 2019-12-31 甲骨文国际公司 用于查询资源高速缓存的系统和方法
CN110637292B (zh) * 2017-05-19 2023-10-10 甲骨文国际公司 用于查询资源高速缓存的系统和方法
US11803547B2 (en) 2017-05-19 2023-10-31 Oracle International Corporation System and method for query resource caching
CN110889042A (zh) * 2019-11-26 2020-03-17 北京梧桐车联科技有限责任公司 资源推荐方法、装置、计算机设备及存储介质
CN110889042B (zh) * 2019-11-26 2022-03-15 北京梧桐车联科技有限责任公司 资源推荐方法、装置、计算机设备及存储介质
CN112559570A (zh) * 2020-12-16 2021-03-26 中国平安财产保险股份有限公司 缓存数据获取方法、装置、设备及存储介质
CN112559570B (zh) * 2020-12-16 2024-05-10 中国平安财产保险股份有限公司 缓存数据获取方法、装置、设备及存储介质

Also Published As

Publication number Publication date
US20180165293A1 (en) 2018-06-14
CN106708833B (zh) 2020-04-07
US11144609B2 (en) 2021-10-12
CN106708833A (zh) 2017-05-24

Similar Documents

Publication Publication Date Title
WO2017020765A1 (zh) 基于位置信息获取数据的方法和装置
CN102546656B (zh) 在社交网络中查找用户的方法、系统和装置
JP5928739B2 (ja) 位置ベースの無線タワー・キャッシング
US8457652B2 (en) Device, method, and system for receiving content on a mobile computing device
US20130073671A1 (en) Offloading traffic to device-to-device communications
WO2017020552A1 (zh) 用于提供无线接入点的接入点信息的方法与设备
US20150156609A1 (en) Prefetching and caching map data based on mobile network coverage
US11172460B2 (en) User location monitoring in mobile edge environment
JP2015537398A (ja) 位置情報を取得する方法、および、そのためのシステム
JP5849155B2 (ja) ユーザコンテンツの取得方法及び取得システム
US20160187143A1 (en) Mechanism for facilitating dynamic location-based zone management for computing systems
US11224040B2 (en) Clientless method for context driven wireless interactions
JP2008517372A (ja) 位置データベースのための装置および方法
KR100597395B1 (ko) 이동통신 단말기를 이용한 위치 정보 검색 장치 및 방법
WO2018032705A1 (zh) 用于提供无线接入点信息包的方法与设备
US9294897B2 (en) Apparatuses and methods for downloading data
JP6682342B2 (ja) 情報提供装置および端末装置
CN111818457B (zh) 一种地理围栏的确定方法、装置、电子设备及存储介质
WO2018121795A1 (zh) 用于连接无线接入点的方法与设备
CN102546846A (zh) 业务服务器地址的获取方法、系统及装置
US8780741B2 (en) On-demand information retrieval using wireless communication devices
JP5992544B2 (ja) ユーザ情報を提供する方法、装置及びコンピュータ記憶媒体
JP2002049622A (ja) 位置関連情報取得装置及びそのシステム並びにその方法並びにそれに用いるプログラムを記録した記録媒体
US20230362268A1 (en) Apparatus, method and computer program
WO2023024541A1 (zh) 设备定位方法和系统、存储介质及电子装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16832253

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15571082

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC , EPO FORM 1205A DATED 06.07.18.

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 06.07.2018)

122 Ep: pct application non-entry in european phase

Ref document number: 16832253

Country of ref document: EP

Kind code of ref document: A1