CN113840234B - Weather information acquisition method, device, system, server and storage medium - Google Patents

Weather information acquisition method, device, system, server and storage medium Download PDF

Info

Publication number
CN113840234B
CN113840234B CN202010583051.7A CN202010583051A CN113840234B CN 113840234 B CN113840234 B CN 113840234B CN 202010583051 A CN202010583051 A CN 202010583051A CN 113840234 B CN113840234 B CN 113840234B
Authority
CN
China
Prior art keywords
weather
weather information
target
area
server
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202010583051.7A
Other languages
Chinese (zh)
Other versions
CN113840234A (en
Inventor
王子健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oneplus Technology Shenzhen Co Ltd
Original Assignee
Oneplus Technology Shenzhen Co Ltd
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 Oneplus Technology Shenzhen Co Ltd filed Critical Oneplus Technology Shenzhen Co Ltd
Priority to CN202010583051.7A priority Critical patent/CN113840234B/en
Publication of CN113840234A publication Critical patent/CN113840234A/en
Application granted granted Critical
Publication of CN113840234B publication Critical patent/CN113840234B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/02Services making use of location information
    • H04W4/021Services related to particular areas, e.g. point of interest [POI] services, venue services or geofences
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/52Network services specially adapted for the location of the user terminal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/53Network services using third party service providers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/10Information and communication technologies [ICT] supporting adaptation to climate change, e.g. for weather forecasting or climate simulation

Abstract

The application provides a weather information acquisition method, a weather information acquisition device, a weather information acquisition system, a weather information acquisition server and a weather information storage medium. The server firstly searches whether weather information of a target weather area to which a target place belongs is cached from local after acquiring a weather acquisition request of the client to the target place by caching the weather information of a part of the weather area. Because the weather information of the target weather area of the target place is acquired from the third party server only when the weather information of the target weather area of the target place is not cached locally, the request quantity of the third party server can be reduced, the request cost is further reduced, and meanwhile, the request load of the third party server can be reduced.

Description

Weather information acquisition method, device, system, server and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a weather information acquisition method, apparatus, system, server, and storage medium.
Background
Most of the current electronic devices have a positioning function, and acquiring weather information of a current position from a server based on the positioning function becomes a common functional requirement in daily life. Currently, a server responds to a weather acquisition request by acquiring weather information corresponding to location information from a third party server (e.g., a server of a weather center) based on the location information in the weather acquisition request. However, there is some request cost to obtain weather information from the third party server, and the request cost is positively correlated with the number of requests. Meanwhile, if the request amount of the user is too large, the load of the third party server is certainly increased.
Disclosure of Invention
To overcome at least one of the disadvantages in the prior art, one of the objects of the present application is to provide a weather information acquisition method applied to a server in communication with a client, the server caching weather information of a plurality of weather areas, the method comprising:
acquiring a weather acquisition request sent by the client, wherein the weather acquisition request carries the position information of a target place;
searching whether weather information of a target weather area to which the target place belongs is cached according to the position information;
if the weather information of the target weather area is cached, sending the cached weather information of the target weather area to the client;
if the weather information of the target weather area is not cached, the weather information of the target weather area is acquired from a third party server, and the weather information of the target weather area acquired from the third party server is sent to the client.
Optionally, the weather information is preset with a buffer duration threshold value for indicating the effective buffer time of the weather information, and the method further includes:
acquiring a first request quantity of weather acquisition requests sent by the client in a preset period of time and a second request quantity of weather acquisition requests sent to the third party server;
and adjusting the buffer time length threshold according to the first request quantity and the second request quantity to obtain a new buffer time length threshold, wherein the ratio between the first request quantity and the second request quantity is positively correlated with the new buffer time length threshold.
Optionally, the step of adjusting the buffer duration threshold according to the first request number and the second request number includes:
and adjusting the buffer time length threshold according to the first request quantity and the second request quantity through the following formula:
P=At+b;
wherein, P is the ratio of the first request number to the second request number, a is a preset first coefficient, t is the buffer duration threshold, and b is a preset second coefficient.
Optionally, the method further comprises:
comparing the new buffer time threshold with a preset warning threshold;
and if the new buffer time length threshold exceeds the preset warning threshold, expanding the range of the weather area according to a preset proportion.
Optionally, the weather area is a circular area with a preset radius by taking a reference point as a center of a circle, wherein weather information of the reference point is used for representing weather information in the circular area, and the step of expanding the range of the weather area according to a preset proportion includes:
and expanding the preset radius according to the preset proportion, so that the range of the weather area is expanded.
Optionally, the step of obtaining weather information of the target weather area by the third party server includes:
taking the round area with the preset radius as the target weather area by taking the target place as the circle center;
acquiring weather information of the target place from the third party server;
and taking the weather information of the target place as the weather information of the target weather area.
Optionally, the step of sending the cached weather information of the target weather area to the client includes:
acquiring the caching duration of the cached weather information of the target weather area;
comparing the buffer time length with the buffer time length threshold value;
if the caching duration does not exceed the caching duration threshold, sending the cached weather information of the target weather area to the client;
if the buffer time threshold exceeds the buffer time threshold, weather information of the target weather area is obtained from the third party server;
and sending the weather information of the target weather area acquired from the third party server to the client.
The second object of the present application is to provide a weather information acquisition system, where the weather information acquisition system includes a server and a client, and the server caches weather information of a plurality of weather areas;
the client sends a weather acquisition request to the server, wherein the weather acquisition request carries the position information of a target place;
the server searches whether weather information of a target weather area to which the target place belongs is cached according to the position information;
if the weather information of the target weather area is cached, the server sends the cached weather information of the target weather area to the client;
if the weather information of the target weather area is not cached, acquiring the target weather area from a third party server, and transmitting the target weather area acquired from the third party server to the client;
and the client side provides the weather information of the target weather area for a user.
The application further provides a weather information acquisition device, which is applied to a server communicated with a client, wherein the server caches weather information of a plurality of weather areas, and the weather information acquisition device comprises a request acquisition module, an area searching module, a first sending module and a second sending module;
the request acquisition module is used for acquiring a weather acquisition request sent by the client, wherein the weather acquisition request carries the position information of a target place;
the area searching module is used for searching whether weather information of a target weather area to which the target place belongs is cached or not according to the position information;
the first sending module is used for sending the cached weather information of the target weather area to the client if the weather information of the target weather area is cached;
and the second sending module is used for acquiring the weather information of the target weather area from a third party server if the weather information of the target weather area is not cached, and sending the weather information of the target weather area acquired from the third party server to the client.
A fourth object of the present application is to provide a server including a processor and a memory storing machine-executable instructions executable by the processor, the machine-executable instructions implementing the weather information acquisition method when executed by the processor.
It is a fifth object of the present application to provide a storage medium storing a computer program which, when executed by a processor, implements the weather information acquisition method.
Compared with the prior art, the application has the following beneficial effects:
the embodiment of the application provides a weather information acquisition method, a weather information acquisition device, a weather information acquisition system, a weather information acquisition server and a weather information storage medium. The server firstly searches whether weather information of a target weather area to which a target place belongs is cached from local after acquiring a weather acquisition request of the client to the target place by caching the weather information of a part of the weather area. Because the weather information of the target weather area of the target place is acquired from the third party server only when the weather information of the target weather area of the target place is not cached locally, the request quantity of the third party server can be reduced, the request cost is further reduced, and meanwhile, the request load of the third party server can be reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an interaction scenario provided in an embodiment of the present application;
fig. 2 is a schematic hardware structure of a server according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating steps of a weather information acquiring method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a weather zone provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of an overlapping region according to an embodiment of the present application;
fig. 6 is a schematic diagram of a weather information acquiring apparatus according to an embodiment of the present application.
Icon: 100-server; 200-client; 300-a third party server; 110-weather information acquisition means; 120-memory; 130-a processor; 140-a communication unit; 410-reference point; 420-a preset radius; 500-overlap region; 1101-request acquisition module; 1102-a region finding module; 1103-a first sending module; 1104-a second transmission module.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present application, it should also be noted that, unless explicitly specified and limited otherwise, the terms "disposed," "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present application will be understood in specific cases by those of ordinary skill in the art.
The embodiment of the application provides a weather information acquisition method which is applied to a communication server with a client, wherein weather information of a plurality of weather areas is cached in the server.
Referring to fig. 1, fig. 1 is a schematic diagram of an interaction scenario in which a server 100 communicates with a third party server 300 and at least one client 200 according to an embodiment of the present application. The server 100 may communicate with the client 200 and the third party server 300 over a network to enable data communication or interaction between the server 100 and the client 200 and the third party server 300.
Referring to fig. 2, fig. 2 is a block diagram of the server 100 shown in fig. 1. The server 100 includes a weather information acquiring device 110, a memory 120, a processor 130, and a communication unit 140.
The memory 120, the processor 130, and the communication unit 140 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The weather information acquiring means 110 includes at least one software function module which may be stored in the memory 120 in the form of software or firmware (firmware) or solidified in an Operating System (OS) of the server 100. The processor 130 is configured to execute executable modules stored in the memory 120, such as software functional modules and computer programs included in the weather information acquiring apparatus 110.
The Memory 120 may be, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc. The memory 120 is configured to store a program, and the processor 130 executes the program after receiving an execution instruction. The communication unit 140 is configured to establish a communication connection between the server 100 and the client 200 through the network, and is configured to transmit and receive data through the network.
The processor 130 may be an integrated circuit chip with signal processing capabilities. The processor 130 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Referring to fig. 3, fig. 3 is a flowchart of a weather information acquisition method applied to the server 100 shown in fig. 1, and the method includes steps described in detail below.
Step S100, acquiring a weather acquisition request sent by the client 200, where the weather acquisition request carries location information of a target location.
The location information may be latitude and longitude information acquired by the client 200 through its own positioning device.
Step S200, searching whether weather information of a target weather area to which the target place belongs is cached or not according to the position information.
Step S300, if the weather information of the target weather area is cached, sending the cached weather information of the target weather area to the client 200.
Since the server 100 caches weather information of a plurality of weather areas, if a target weather area including the target location exists among the plurality of weather areas, the weather information of the target weather area may be regarded as the weather information of the target location.
In step S400, if the weather information of the target weather area is not cached, the weather information of the target weather area is obtained from the third party server 300, and the weather information of the target weather area obtained from the third party server is sent to the client 200.
Since the buffer memory is required to occupy a certain memory space, the server 100 only buffers the weather information of a partial area in order to save the memory space. For example, for areas of relatively low population, or areas of no population, the number of weather acquisition requests for these areas is also low, and thus, it is not necessary to cache weather information for areas of relatively low population.
Wherein the third party server 300 may be a server of a weather center. It will be appreciated that obtaining weather information from a server in a weather center takes a certain request cost, where the request cost is positively correlated to the number of requests. In addition, if the request amount is too large, a certain load pressure is applied to the server of the weather center, so the number of times the server has to request weather information from the weather center has a certain upper limit.
Therefore, the server 100, after acquiring the weather acquisition request from the client 200 to the target location, searches locally whether the weather information of the target weather area to which the target location belongs is cached. Since the weather information of the target weather area to which the target location belongs is obtained from the third party server 300 only when the weather information of the target weather area to which the target location belongs is not cached locally, the number of requests with the third party server 300 can be reduced, the request cost can be further reduced, and meanwhile, the request load of the third party server 300 can be reduced.
Further, in order to improve the real-time performance of the weather information, the server 100 presets a buffer duration threshold for indicating the effective buffer time of the weather information for the weather information. Therefore, when sending the cached weather information of the target area to the client 200, as a possible implementation manner, the server 100 obtains the cache duration of the weather information of the target area; and comparing the buffer time with a buffer time threshold.
If the buffer duration does not exceed the buffer duration threshold, the server 100 sends the buffered weather information of the target area to the client 200.
If the buffer duration exceeds the buffer duration threshold, the server 100 obtains the weather information of the target weather area from the third party server 300, and then sends the weather information of the target weather area obtained from the third party server 300 to the client 200. Thus, the real-time performance of weather information is ensured.
It should be appreciated that if the buffer duration threshold is greater, the longer the valid time for the weather information of the buffered weather region, and accordingly, the less frequently the server 100 requests from the third party server 300. However, the lower the frequency of the request to the third party server 300, the weather information of the cached weather area is seriously delayed from the third party server 300, and thus the problem of poor real-time performance is caused.
Since the real-time performance of the weather information is significant for the user, in order to achieve both the request number of the client 200 and the real-time performance of the weather information, as a possible implementation manner, the server 100 obtains the first request number of the weather acquisition requests sent by the client 200 and the second request number of the weather acquisition requests sent to the third party server 300 in a preset period; and adjusting the buffer time length threshold according to the first request quantity and the second request quantity to obtain a new buffer time length threshold, wherein the ratio between the first request quantity and the second request quantity is positively correlated with the new buffer time length threshold.
It should be appreciated that as the cache duration threshold increases, the number of weather acquisition requests sent by the server 100 to the third party server 300 gradually decreases.
For adjusting the buffer-duration threshold according to the first request number and the second request number, in one possible example, the server 100 adjusts the buffer-duration threshold according to the first request number and the second request number by the following formula:
P=At+b;
wherein, P is the ratio of the first request number to the second request number, a is a preset first coefficient, t is the buffer duration threshold, and b is a preset second coefficient.
The formula is used for obtaining the first request quantity and the second request quantity when different buffer time thresholds are obtained by adjusting the buffer time thresholds under the condition that the weather area is kept to be in a preset size. Based on the obtained first request quantity and second request quantity in different buffer time length thresholds, the method is obtained through linear fitting.
It should be noted that, the weather information is set with the minimum standard real-time requirement, so the buffer time length is set with the preset alert threshold. When the new buffer duration threshold exceeds the preset alert threshold, it indicates that the number of clients 200 that initiate the weather acquisition request is excessive, and in order to ensure the real-time performance of the minimum standard of the weather information, the server 100 enlarges the range of the weather area according to the preset proportion. Since the range of the weather area is enlarged, the target location requested by the client 200 can be found with a high probability to which the target weather area belongs, and the server 100 can reduce the number of weather acquisition requests to be issued to the third party server 300.
Of course, the server 100 is also provided with a range threshold in view of the need to ensure the accuracy and real-time of the weather information acquired by the user, the range of the weather area cannot be increased continuously without limit. The server 100 compares the range of the enlarged weather zone to the range threshold. If the comparison result indicates that the range of the enlarged weather area exceeds the range threshold, the server 100 provides corresponding warning information.
In addition, since the range of the weather area affects the accuracy and instantaneity of the weather information, when the server 100 initiates the number of weather acquisition requests to the third party server 300 to be smaller than the preset request threshold, the range of the weather area is narrowed down to a specific range, so that the accuracy and instantaneity of the weather information are improved.
Referring to fig. 4, as a possible embodiment, the weather area is a circular area with a preset radius 420 around a reference point 410, where the weather information of the reference point 410 is used to represent the weather information of all the places in the circular area. Accordingly, when the server 100 expands the range of the weather zone according to a preset ratio, the preset radius 420 may be expanded according to the preset ratio, so that the range of the weather zone is expanded.
Because the weather area is a circular area with the reference point 410 as a center of a circle and the preset radius 420, when searching whether the weather information of the target weather area to which the target location belongs is cached according to the location information, the server 100 calculates the distance between the target location and the center position of each weather area according to the location information. Wherein the distance between the target location and the central location of the target weather zone does not exceed the preset radius 420.
Because the weather area is a circular area with the reference point 410 as the center of the circle and the preset radius 420, if the server 100 does not cache the weather information of the target weather area to which the target location belongs, the server 100 will use the target location as the center of the circle and the circular area with the preset radius 420 as the target weather area when acquiring the weather information of the target weather area from the third party server 300; and obtains weather information of the target location from the third party server 300, and takes the weather information of the target location as weather information of the target weather area.
Therefore, the server 100 dynamically generates the target weather areas according to the target location requested by the client 200, so that the server 100 does not have to consume a large amount of storage space to buffer the weather information of each weather area.
Alternatively, referring to fig. 5, since the weather area is a circular area with the reference point 410 as a center, the overlapping area 500 may exist between the weather areas. If the target location is located in the overlapping area 500 between the multiple target weather areas, as a possible implementation manner, the server 100 sends the multiple target weather areas to which the target location belongs to the client 200, so that the client 200 provides multiple weather information for the user to select by the user.
As another possible embodiment, the server 100 calculates the distance between the target location and the center position of each target weather area according to the location information of the target location, and selects the weather information of the target weather area with the smallest distance and sends the weather information to the client 200.
Optionally, the server 100 further sends the buffer duration of the weather information of the target weather area, the buffer duration threshold value, and the location of the target weather area to the client 200, so that the client 200 buffers the weather information.
Before the client 200 initiates the new weather obtaining request again, the client 200 obtains the position information of the new target location in the new weather obtaining request, and determines whether the target weather area to which the new target location belongs exists in the locally cached weather area. If there is a target weather area to which the new target location belongs, the client 200 determines whether the weather information of the target weather area to which the new target location belongs needs to be updated, and if not, acquires the weather information of the new target location locally.
The embodiment of the application also provides a weather information acquisition system, which comprises a server 100 and a client 200, wherein the server 100 caches the weather information of a plurality of weather areas;
the client 200 sends a weather acquisition request to the server 100, where the weather acquisition request carries location information of a target location;
the client 200 sends a weather acquisition request to the server 100, where the weather acquisition request carries location information of a target location;
the server 100 searches whether weather information of a target weather area to which the target location belongs is cached according to the position information;
if the weather information of the target weather area is cached, the server 100 sends the cached weather information of the target weather area to the client 200;
if the weather information of the target weather area is not cached, the target weather area is acquired from the third party server 300, and the target weather area acquired from the third party server 300 is sent to the client 200.
The client 200 provides weather information of the target weather zone to a user.
In an embodiment of the present application, the server 100 may be an online server that the manufacturer provides a relay service, and the client 200 may be a handheld device, such as a mobile phone, a notebook computer, a tablet computer, etc. The server 100 may also be a mobile phone, a notebook computer, a tablet computer, etc., and the client 200 may be a smart watch, a smart bracelet, or other devices connected to the mobile phone, the notebook computer, or the tablet computer in a communication manner. The server 100 may also be a network Access Point (Access Point) or a Base Station (Base Station), and the client 200 may be an internet of things device communicatively connected to the network Access Point or the Base Station.
The embodiment of the present application further provides a weather information obtaining apparatus 110, where the weather information obtaining apparatus 110 includes at least one functional module that may be stored in the memory 120 in the form of software. Referring to fig. 6, functionally divided, the weather information acquiring apparatus 110 may include a request acquiring module 1101, a region searching module 1102, a first transmitting module 1103, and a second transmitting module 1104.
The request acquisition module 1101 is configured to acquire a weather acquisition request sent by the client 200, where the weather acquisition request carries location information of a target location.
In the embodiment of the present application, the request obtaining module 1101 is configured to perform step S100 in fig. 3, and the detailed description of the request obtaining module 1101 may refer to the detailed description of step S100.
The region searching module 1102 is configured to search whether weather information of a target weather region to which the target location belongs is cached according to the location information.
In the embodiment of the present application, the area searching module 1102 is configured to perform step S200 in fig. 3, and for a detailed description of the area searching module 1102, reference may be made to the detailed description of step S200.
The first sending module 1103 is configured to send the cached weather information of the target weather area to the client 200 if the weather information of the target weather area is cached.
In the embodiment of the present application, the first sending module 1103 is configured to perform step S300 in fig. 3, and for a detailed description of the first sending module 1103, reference may be made to the detailed description of step S300.
The second sending module 1104 is configured to obtain weather information of the target weather area from the third party server 300 if the weather information of the target weather area is not cached, and send the weather information of the target weather area obtained from the third party server 300 to the client 200.
In an embodiment of the present application, the second transmitting module 1104 is configured to perform step S400 in fig. 3, and the detailed description of the second transmitting module 1104 may refer to the detailed description of step S400.
The embodiment of the present application further provides a server 100, where the server 100 includes a processor 130 and a memory 120, where the memory 120 stores machine executable instructions capable of being executed by the processor 130, and the machine executable instructions implement the weather information acquisition method when executed by the processor 130.
The embodiment of the present application further provides a storage medium, where the memory 120 stores a computer program, and the computer program implements the weather information obtaining method when executed by the processor 130.
In summary, the embodiment of the application provides a weather information acquisition method, device, system, server and storage medium. The server firstly searches whether weather information of a target weather area to which a target place belongs is cached from local after acquiring a weather acquisition request of the client to the target place by caching the weather information of a part of the weather area. Because the weather information of the target weather area of the target place is acquired from the third party server only when the weather information of the target weather area of the target place is not cached locally, the request quantity of the third party server can be reduced, the request cost is further reduced, and meanwhile, the request load of the third party server can be reduced.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is merely illustrative of various embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about variations or substitutions within the scope of the present application, and the application is intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. The weather information acquisition method is characterized by being applied to a server communicated with a client, wherein the server caches weather information of a plurality of weather areas, and the weather information is preset with a cache duration threshold value for indicating effective cache time of the weather information, and the method comprises the following steps:
acquiring a weather acquisition request sent by the client, wherein the weather acquisition request carries the position information of a target place;
searching whether weather information of a target weather area to which the target place belongs is cached according to the position information;
if the weather information of the target weather area is cached, sending the cached weather information of the target weather area to the client;
if the weather information of the target weather area is not cached, acquiring the weather information of the target weather area from a third party server, and transmitting the weather information of the target weather area acquired from the third party server to the client;
acquiring a first request quantity of weather acquisition requests sent by the client in a preset period of time and a second request quantity of weather acquisition requests sent to the third party server;
the buffer time threshold is adjusted according to the first request quantity and the second request quantity, a new buffer time threshold is obtained, and the expression is:
in the method, in the process of the application,for the ratio of said first number of requests to said second number of requests +.>For presetting a first coefficient, < >>For the buffer duration threshold, < >>The second coefficient is preset.
2. The weather information acquisition method according to claim 1, characterized in that the method further comprises:
comparing the new buffer time threshold with a preset warning threshold;
and if the new buffer time length threshold exceeds the preset warning threshold, expanding the range of the weather area according to a preset proportion.
3. The method for obtaining weather information according to claim 2, wherein the weather area is a circular area with a preset radius around a reference point, wherein the weather information of the reference point is used for representing the weather information in the circular area, and the step of expanding the range of the weather area according to a preset ratio comprises:
and expanding the preset radius according to the preset proportion, so that the range of the weather area is expanded.
4. The weather information acquiring method as claimed in claim 3, wherein the step of acquiring the weather information of the target weather zone by the third party server comprises:
taking the round area with the preset radius as the target weather area by taking the target place as the circle center;
acquiring weather information of the target place from the third party server;
and taking the weather information of the target place as the weather information of the target weather area.
5. The weather information acquiring method according to claim 1, wherein the step of transmitting the cached weather information of the target weather zone to the client comprises:
acquiring the caching duration of the cached weather information of the target weather area;
comparing the buffer time length with the buffer time length threshold value;
if the caching duration does not exceed the caching duration threshold, sending the cached weather information of the target weather area to the client;
if the buffer time threshold exceeds the buffer time threshold, weather information of the target weather area is obtained from the third party server;
and sending the weather information of the target weather area acquired from the third party server to the client.
6. The weather information acquisition system is characterized by comprising a server and a client, wherein the server caches weather information of a plurality of weather areas, and the weather information is preset with a cache duration threshold value for indicating the effective cache time of the weather information;
the client sends a weather acquisition request to the server, wherein the weather acquisition request carries the position information of a target place;
the server searches whether weather information of a target weather area to which the target place belongs is cached according to the position information;
if the weather information of the target weather area is cached, the server sends the cached weather information of the target weather area to the client;
if the weather information of the target weather area is not cached, acquiring the target weather area from a third party server, and transmitting the target weather area acquired from the third party server to the client;
the client side provides weather information of the target weather area for a user;
the server also acquires a first request number of weather acquisition requests sent by the client in a preset period and a second request number of weather acquisition requests sent to the third party server;
the buffer time threshold is adjusted according to the first request quantity and the second request quantity, a new buffer time threshold is obtained, and the expression is:
in the method, in the process of the application,for the ratio of said first number of requests to said second number of requests +.>For presetting a first coefficient, < >>For the buffer duration threshold, < >>The second coefficient is preset.
7. The weather information acquisition device is characterized by being applied to a server in communication with a client, wherein the server caches weather information of a plurality of weather areas, the weather information is preset with a cache duration threshold value for indicating the effective cache time of the weather information, and the weather information acquisition device comprises a request acquisition module, an area searching module, a first sending module and a second sending module;
the request acquisition module is used for acquiring a weather acquisition request sent by the client, wherein the weather acquisition request carries the position information of a target place;
the area searching module is used for searching whether weather information of a target weather area to which the target place belongs is cached or not according to the position information;
the first sending module is used for sending the cached weather information of the target weather area to the client if the weather information of the target weather area is cached;
the second sending module is used for obtaining weather information of the target weather area from a third party server if the weather information of the target weather area is not cached, and sending the weather information of the target weather area obtained from the third party server to the client;
the weather information acquisition device is also used for acquiring a first request quantity of weather acquisition requests sent by the client in a preset period and a second request quantity of weather acquisition requests sent to the third party server;
the buffer time threshold is adjusted according to the first request quantity and the second request quantity, a new buffer time threshold is obtained, and the expression is:
in the method, in the process of the application,for the ratio of said first number of requests to said second number of requests +.>For presetting a first coefficient, < >>For the buffer duration threshold, < >>The second coefficient is preset.
8. A server comprising a processor and a memory storing machine executable instructions executable by the processor, which when executed by the processor, implement the weather information acquisition method according to any one of claims 1-5.
9. A storage medium storing a computer program which, when executed by a processor, implements the weather information acquisition method according to any one of claims 1 to 5.
CN202010583051.7A 2020-06-23 2020-06-23 Weather information acquisition method, device, system, server and storage medium Active CN113840234B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010583051.7A CN113840234B (en) 2020-06-23 2020-06-23 Weather information acquisition method, device, system, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010583051.7A CN113840234B (en) 2020-06-23 2020-06-23 Weather information acquisition method, device, system, server and storage medium

Publications (2)

Publication Number Publication Date
CN113840234A CN113840234A (en) 2021-12-24
CN113840234B true CN113840234B (en) 2023-10-24

Family

ID=78964140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010583051.7A Active CN113840234B (en) 2020-06-23 2020-06-23 Weather information acquisition method, device, system, server and storage medium

Country Status (1)

Country Link
CN (1) CN113840234B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101340461A (en) * 2008-08-08 2009-01-07 凯立德欣技术(深圳)有限公司 Method for obtaining weather forecast information of designated region
CN104601675A (en) * 2014-12-29 2015-05-06 小米科技有限责任公司 Server load balancing method and device
CN104796441A (en) * 2014-01-17 2015-07-22 腾讯科技(深圳)有限公司 Information display method and terminal
CN105743773A (en) * 2016-01-26 2016-07-06 广东欧珀移动通信有限公司 Weather data acquisition method and device
CN106209981A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 Hot water machine and the method obtaining Weather information, device and system
CN109299144A (en) * 2018-08-22 2019-02-01 北京奇艺世纪科技有限公司 A kind of data processing method, device, system and application server
CN110493722A (en) * 2019-07-18 2019-11-22 平安科技(深圳)有限公司 The method, apparatus and computer equipment of offer Weather information based on data analysis

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8562422B2 (en) * 2006-09-28 2013-10-22 Cfph, Llc Products and processes for processing information related to weather and other events
US20120150446A1 (en) * 2010-12-10 2012-06-14 Google Inc. Interactive User Interface for Weather Data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101340461A (en) * 2008-08-08 2009-01-07 凯立德欣技术(深圳)有限公司 Method for obtaining weather forecast information of designated region
CN104796441A (en) * 2014-01-17 2015-07-22 腾讯科技(深圳)有限公司 Information display method and terminal
CN104601675A (en) * 2014-12-29 2015-05-06 小米科技有限责任公司 Server load balancing method and device
CN105743773A (en) * 2016-01-26 2016-07-06 广东欧珀移动通信有限公司 Weather data acquisition method and device
CN106209981A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 Hot water machine and the method obtaining Weather information, device and system
CN109299144A (en) * 2018-08-22 2019-02-01 北京奇艺世纪科技有限公司 A kind of data processing method, device, system and application server
CN110493722A (en) * 2019-07-18 2019-11-22 平安科技(深圳)有限公司 The method, apparatus and computer equipment of offer Weather information based on data analysis

Also Published As

Publication number Publication date
CN113840234A (en) 2021-12-24

Similar Documents

Publication Publication Date Title
KR100791628B1 (en) Method for active controlling cache in mobile network system, Recording medium and System thereof
US9648097B2 (en) Cloud-to-device messaging for application activation and reporting
US11889375B2 (en) Tracking device location identification
US20170359415A1 (en) Multi-device context store
US20060277277A1 (en) Method of automatically caching WAP web pages and a mobile communications device for the same
US9736781B2 (en) Determining points of interest within a geofence
US20070124393A1 (en) Presence based notifications
CN110858843A (en) Service request processing method and device and computer readable storage medium
CN111131856A (en) Cache expiration time adjusting method and device, electronic equipment and storage medium
KR20150032745A (en) Managing power consumption in mobile devices
CN110932988A (en) Flow control method and device, electronic equipment and readable storage medium
US20120206259A1 (en) System and method for remote alarm management of one or more objects
CN109905840B (en) Positioning method, device and system and wireless access equipment
CN107623702B (en) Data caching method, device and system
CN113840234B (en) Weather information acquisition method, device, system, server and storage medium
US20190253831A1 (en) Method of balance of accuracy and power consumption for geofence
EP2891343B1 (en) Efficient proximity detection
US20030134628A1 (en) On a mobile device
CN111125138A (en) Method, device, computer equipment and storage medium for polling data
CN107819761B (en) Data processing method and device and readable storage medium
US20150312751A1 (en) Method for Transmitting Massive Data by Using Dynamically Adjusted Updating Frequencies
CN113873003B (en) Data transmission control method and system between storage end and communication end in Internet of things
CN112449440B (en) Wireless resource control method, device, electronic equipment and storage medium
CN109688187B (en) Flow load balancing method, device, equipment and readable storage medium
CN112256659A (en) Log reporting method, receiving method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant