Iot message cache instruction quantity control method and device, equipment and medium

By acquiring the number of cached instructions from IoT devices and determining whether a threshold has been reached, downlink instructions are intercepted. This solves the problem of wasted storage resources and performance degradation caused by device offline on IoT platforms, achieving efficient and stable operation and performance improvement of the platform.

CN116781746BActive Publication Date: 2026-05-29E SURFING IOT CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
E SURFING IOT CO LTD
Filing Date
2023-08-11
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

IoT platforms suffer from wasted storage resources and performance degradation due to device offline issues, leading to increased storage pressure and even security risks.

Method used

By obtaining the number of device, product, and tenant cache instructions for the device to be pushed, it is determined whether the preset threshold has been reached. If it has, the downlink instructions are intercepted and capacity threshold limit information is sent, and the cache capacity is dynamically adjusted to reduce storage and performance pressure.

Benefits of technology

It effectively reduces the storage and performance pressure on the platform, ensures the platform's efficient and stable operation, and improves the performance and reliability of downlink scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781746B_ABST
    Figure CN116781746B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a kind of Internet of Things message cache instruction quantity control method, device, equipment and medium.The method comprises: if receiving the downlink instruction sent to the device to be pushed, the product and tenant to which the device to be pushed belongs are obtained according to the downlink instruction;According to the preset device identifier, the preset product identifier and the preset tenant identifier and the preset cache calculation method, the device cache instruction quantity of the device to be pushed, the product cache instruction quantity of the product and the tenant cache instruction quantity of the tenant are obtained;Whether the device cache instruction quantity, the product cache instruction quantity and the tenant cache instruction quantity reach the preset instruction quantity threshold corresponding thereto is judged;If any one of them reaches the preset instruction quantity threshold corresponding thereto, the downlink instruction is intercepted, and the capacity threshold limit information corresponding thereto is sent to SAAS application.Through the method of the embodiment of the application, the pressure of platform storage system can be relieved, and the reliability and stability of the platform can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) technology, and in particular to a method, apparatus, device, and medium for controlling the number of IoT message cache instructions. Background Technology

[0002] With the development of technology, people's lives are becoming increasingly intelligent. As a connection platform connecting smart devices and SaaS (Software as a Service), the Internet of Things (IoT) platform needs to forward downlink commands from SaaS applications to devices. If a device is offline, the downlink commands need to be cached so that the device can quickly receive the corresponding downlink command data when it reconnects. However, with the large-scale development of IoT, the number of devices and applications connected to the platform is constantly increasing, and the number of downlink commands that the platform needs to cache is gradually increasing. In addition, some devices connected to the platform are offline for a long time, which leads to the waste of platform storage resources, increased storage pressure, and performance degradation, and may even bring security risks to the platform. Summary of the Invention

[0003] This invention provides a method, apparatus, device, and medium for controlling the number of IoT message cache instructions, aiming to alleviate the pressure on the platform's storage system, improve the platform's performance in downlink scenarios, and enhance the platform's reliability and stability.

[0004] In a first aspect, embodiments of the present invention provide a method for controlling the number of IoT message cache instructions, comprising: if a downlink instruction sent to a device to be pushed is received, obtaining the product and tenant to which the device to be pushed belongs based on the downlink instruction; obtaining the number of device cache instructions of the device to be pushed, the number of product cache instructions of the product, and the number of tenant cache instructions of the tenant based on a preset device identifier, a preset product identifier, a preset tenant identifier, and a preset cache calculation method; determining whether the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions reach a corresponding preset instruction number threshold; if any one of the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions reaches the corresponding preset instruction number threshold, intercepting the downlink instruction and sending corresponding capacity threshold limit information to the SaaS application.

[0005] Secondly, embodiments of the present invention also provide an IoT message cache instruction quantity control device, comprising: an acquisition unit, configured to acquire the product and tenant to which the device to be pushed belongs based on the downlink instruction if a downlink instruction sent to the device to be pushed is received; a calculation unit, configured to acquire the device cache instruction quantity of the device to be pushed, the product cache instruction quantity of the product, and the tenant cache instruction quantity of the tenant based on a preset device identifier, a preset product identifier, a preset tenant identifier, and a preset cache calculation method; a judgment unit, configured to judge whether the device cache instruction quantity, the product cache instruction quantity, and the tenant cache instruction quantity reach a corresponding preset instruction quantity threshold; and an interception unit, configured to intercept the downlink instruction and send corresponding capacity threshold limit information to the SAAS application if any one of the device cache instruction quantity, the product cache instruction quantity, and the tenant cache instruction quantity reaches the corresponding preset instruction quantity threshold.

[0006] Thirdly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0007] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, can implement the above-described method.

[0008] This invention provides a method, apparatus, device, and medium for controlling the number of IoT message cache instructions. The method includes: if a downlink instruction is received and sent to a device to be pushed, then obtaining the product and tenant to which the device to be pushed belongs based on the downlink instruction; obtaining the number of device cache instructions for the device to be pushed, the number of product cache instructions for the product, and the number of tenant cache instructions for the tenant based on a preset device identifier, a preset product identifier, a preset tenant identifier, and a preset cache calculation method; determining whether the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions reach a corresponding preset instruction number threshold; if any one of the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions reaches the corresponding preset instruction number threshold, then intercepting the downlink instruction and sending corresponding capacity threshold restriction information to the SaaS application. In this embodiment of the invention, different preset instruction quantity thresholds are configured according to the device, product, and tenant. When a downlink instruction is received, the number of product cache instructions to which the device to be pushed belongs, the number of cache instructions of the tenant, and the number of device cache instructions of the device itself are obtained. It is then determined whether the number of cache instructions exceeds the corresponding preset instruction quantity threshold. If the number of any one of the cache instructions exceeds its corresponding preset instruction quantity threshold, the downlink instruction is intercepted. This enables real-time dynamic adjustment of the cache capacity for different tenants, products, and devices, effectively reducing the pressure on the platform in terms of storage and performance, ensuring the platform operates efficiently and stably, and improving the performance of the platform in downlink scenarios. Attached Figure Description

[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A flowchart illustrating the method for controlling the number of IoT message caching instructions provided in an embodiment of the present invention;

[0011] Figure 2 A schematic diagram of a sub-process of the IoT message caching instruction quantity control method provided in an embodiment of the present invention;

[0012] Figure 3 A schematic diagram of a sub-process of the IoT message caching instruction quantity control method provided in an embodiment of the present invention;

[0013] Figure 4 A schematic diagram of a sub-process of the IoT message caching instruction quantity control method provided in an embodiment of the present invention;

[0014] Figure 5 A flowchart of an IoT message cache instruction quantity control method provided in an embodiment of the present invention;

[0015] Figure 6 A schematic block diagram of an IoT message cache instruction quantity control device provided in an embodiment of the present invention;

[0016] Figure 7 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0019] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0020] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0021] Please see Figure 1 , Figure 1This is a flowchart illustrating the IoT message cache command quantity control method provided in this embodiment of the invention. The IoT message cache command quantity control method in this embodiment can be applied to the process of forwarding downlink command requests from SaaS applications to devices via an IoT platform. This solution uses Nacos Configuration Center (a dynamic service discovery, configuration management, and service management platform that is easier to build cloud-native applications) as the configuration manager and a Redis cluster (a high-performance key-value non-relational database based on memory, containing multiple data structures, supporting network, and with optional persistence) as the distributed cache queue. This effectively alleviates the pressure on the platform's storage system when SaaS applications issue massive downlink commands, improves the performance of the platform in downlink scenarios, and enhances the platform's reliability and stability.

[0022] Figure 1 This is a flowchart illustrating the IoT message cache instruction quantity control method provided in an embodiment of the present invention. As shown in the figure, the method includes the following steps S110-S140.

[0023] S110. If a downlink instruction sent to the device to be pushed is received, the product and tenant to which the device to be pushed belongs are obtained according to the downlink instruction.

[0024] In this embodiment, the downlink instruction is an instruction from the server to transmit data to the client. Upon receiving the downlink instruction, a pre-processor within the platform retrieves the product and tenant to which the device to be pushed belongs, based on the downlink instruction. The product and tenant are added when a user registers an account on the platform. Furthermore, one tenant can correspond to multiple products, and one product can correspond to multiple devices; therefore, the information of the tenant and product to which a device belongs can be obtained based on that device. By retrieving the product and tenant to which the device to be pushed belongs, the push of downlink instructions can be controlled according to the different needs of the tenant, product, and device.

[0025] In one embodiment, such as Figure 2 As shown, step S110 includes steps S111-S112.

[0026] S111. According to the downlink instruction, obtain the preset product identifier and the preset tenant identifier of the device to be pushed;

[0027] S112. Obtain the product and the tenant to which the device to be pushed belongs based on the preset product identifier and the preset tenant identifier.

[0028] In this embodiment, the preset product identifier and the preset tenant identifier are global identifiers assigned by the platform when a user registers an account, creates a product, or adds a device on the platform. These identifiers are unique. The preset instruction preprocessor can obtain the tenant and product to which the device to be pushed belongs through these unique global identifiers. For example, if the downlink instruction carries T1, and T1 is a preset tenant identifier, the tenant information can be obtained based on T1. By obtaining the preset product identifier and the preset tenant identifier of the device to be pushed according to the downlink instruction, and obtaining the product and the tenant to which the device to be pushed belongs based on the product identifier and the tenant identifier, the downlink instruction can be allocated on demand according to the device, the product, and the tenant, alleviating the pressure on the platform's storage system.

[0029] S120. Obtain the number of device cache instructions for the device to be pushed and the number of product cache instructions for the product, as well as the number of tenant cache instructions for the tenant, based on the preset device identifier, preset product identifier, preset tenant identifier, and preset cache calculation method.

[0030] In this embodiment, the number of device cache instructions is the cumulative value of downlink instructions received by the device when it is offline; the number of product cache instructions is the cumulative value of downlink instructions received by the product to which the device belongs; and the number of tenant cache instructions is the cumulative value of downlink instructions received by the product to which the device belongs. It should be noted that because the relationship between tenants and products is one-to-many, and the relationship between products and devices is also one-to-many, for the same number of downlink instructions, the number of device cache instructions is less than the number of product cache instructions and the number of tenant cache instructions. The preset cache calculation method is a method for obtaining the cache quantity. The preset cache calculation method may include functions such as redis.llen() and redis.get() to obtain a specific queue length value or a specific key value. For example, if the preset tenant identifier is T1, the method for obtaining the number of tenant cache instructions can be: CT1 = redis.get(“count:T1”), where CT1 is the number of tenant cache instructions. The instruction preprocessor obtains the number of device and product cache instructions for the device to be pushed and the number of tenant cache instructions for the product based on the preset device identifier, preset product identifier, preset tenant identifier and preset cache calculation method, which can provide data support for subsequent judgment.

[0031] In one embodiment, such as Figure 3 As shown, step S120 includes steps S121-S123.

[0032] S121. Based on the preset device identifier, the preset product identifier, the preset tenant identifier, and the preset separator, obtain the primary key values ​​corresponding to the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions;

[0033] S122. The primary key values ​​are concatenated using a preset concatenation character to obtain the corresponding target key value;

[0034] S123. Obtain the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions based on the target key value and the preset cache calculation method.

[0035] In this embodiment, the preset separator is a preset symbol used to divide the preset device identifier, the preset product identifier, and the preset tenant identifier. It may include " / ", "\", "|", etc. In this embodiment, " / " can be used as the preset separator. For example, according to the relationship between the tenant, product, and device mentioned above, to obtain the number of device cache instructions, it is necessary to obtain the number of device cache instructions based on the preset device identifier and the corresponding product identifier and tenant identifier. That is, it is necessary to concatenate the three identifiers into a string for acquisition. However, in order to ensure the clarity of the string, a preset separator is used. When obtaining the number of device cache instructions, the required primary key value is found to be: T1 / P1 / D1, where T1 is the preset tenant identifier, P1 is the preset product identifier, and D1 is the preset device identifier. If the primary key value of the product cache instruction number is T1 / P1, and if the primary key value of the tenant cache instruction number is T1, then the preset separator can be omitted. The preset concatenation operator is a symbol used to connect the initial key-value pairs, such as "count". By using the preset concatenation operator to connect the initial key-value pairs, the corresponding target key-value pairs can be obtained. For example, the target key-value pairs corresponding to the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions are count:T1 / P1 / D1, count:T1 / P1, and count:T1, respectively. The methods for obtaining the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions according to the preset cache calculation method and the target key-value pairs are: redis.llen("count:T1 / P1 / D1"), redis.get("count:T1 / P1"), and redis.get("count:T1"). Here, redis.llen() and redis.get() are preset Redis cluster functions for obtaining specific queue length values ​​and specific key-value pairs. By obtaining the target key value based on the primary key value, as well as the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions, it is convenient to dynamically adjust and control the cache capacity in the future. This effectively alleviates the pressure on storage and performance, ensures the platform's continuous, efficient, and stable operation, and improves the overall performance of the IoT platform.

[0036] S130. Determine whether the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions have reached the corresponding preset instruction number threshold.

[0037] In this embodiment, the preset instruction quantity threshold is a preset maximum value that can be cached for the downlink. This preset instruction quantity threshold can be configured by a preset configuration manager or by the user. The preset configuration manager is the Nacos Configuration Center. When the preset instruction quantity threshold is updated, the corresponding configuration information takes effect without redeploying the application and services, greatly improving the platform's operational capabilities. When the preset instruction quantity threshold and other configurations change, a change notification is sent to a preset instruction preprocessor, which refreshes the configuration. Specifically, the instruction preprocessor uses the preset device identifier, the preset product identifier, and the preset tenant identifier as keys to extract the preset instruction quantity thresholds for the tenant, product, and device to be pushed from memory. This allows it to determine whether the number of cached instructions for the device, product, and tenant reaches the corresponding preset instruction quantity threshold. By determining whether the number of cached instructions reaches the corresponding preset instruction quantity threshold, it can be determined whether the downlink instruction needs to be forwarded.

[0038] In one embodiment, such as Figure 4 As shown, step S130 includes steps S1301-S1302.

[0039] S1301. If the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions all fail to reach the corresponding preset instruction number threshold, then determine whether the device to be pushed is online.

[0040] S1302. If the device to be pushed is offline, the downlink instruction is stored at the end of a preset cache queue.

[0041] In this embodiment, the preset cache queue is a queue for storing the downlink instructions to be pushed. The instruction cache caches the downlink instructions issued by the SAAS application during the offline period of the device to be pushed, as well as the cumulative count of the cached instruction values ​​under the corresponding tenant and product. A Redis cluster is used as the instruction cache, and a List queue structure is allocated to each device. Each instruction request is stored in the queue in chronological order. This queue is the preset cache queue in this embodiment. If the number of cached instructions for the device, the number of cached instructions for the product, and the number of cached instructions for the tenant all do not reach the corresponding preset instruction number threshold, it means that caching the downlink instruction in the platform will not affect the platform's storage and performance. In this case, the preset instruction preprocessor sends the downlink instruction to the preset instruction sender. The instruction sender determines whether the device to be pushed is online. If it is online, it can be pushed directly. If it is offline, the preset instruction sender stores the downlink instruction at the tail of the preset cache queue of the preset instruction cache. For example, if the preset cache queue has already stored 8 downlink instructions, the latest downlink instruction is cached at the tail of the preset cache queue, which is the ninth downlink instruction in the preset cache queue. Storing the downlink instruction at the tail of the preset cache queue allows for sequential pushing when the device logs back in, ensuring the platform operates efficiently and stably and improving the performance of the platform in downlink scenarios.

[0042] In this embodiment, the steps further include: accumulating the number of product cache instructions and the number of tenant cache instructions according to a preset storage method. The preset storage method is a method for accumulating the number of product cache instructions and the number of tenant cache instructions by storing the downlink instructions in a preset cache queue of a preset instruction cache. The preset instruction sender performs the accumulation operation on the number of product cache instructions and the number of tenant cache instructions according to the target key value and the preset storage method. Specifically, the statements for accumulating the number of product cache instructions and the number of tenant cache instructions are: redis.incr(“count:T1”) and redis.incr(“count:T1 / P1”), where redis.incr() is a preset method in this embodiment for incrementing the target key value. Accumulating the number of product cache instructions and the number of tenant cache instructions according to the preset storage method facilitates the management of the number of product cache instructions and the number of tenant cache instructions, and also facilitates the subsequent acquisition of the data on the number of product cache instructions and the number of tenant cache instructions.

[0043] In one embodiment, such as Figure 4 As shown, step S130 includes step S1303.

[0044] S1303. If the device to be pushed is detected to log in again, the downlink instructions in the preset cache queue are pushed to the device to be pushed in sequence.

[0045] In this embodiment, after the preset instruction sender stores the downlink instructions to the tail of the preset cache queue of the preset instruction cache, when the offline device to be pushed is detected to log in again, the preset instruction sender sends the cached downlink instructions from the head of the preset cache queue one by one to the device to be pushed. For example, if the preset cache queue has cached 10 downlink instructions, when the device to be pushed logs in again, the downlink instructions are sent to the device one by one, starting from the first downlink instruction. By pushing the downlink instructions to the device to be pushed in sequence, the platform can operate efficiently and stably.

[0046] In this embodiment, the method further includes: decrementing the number of product cache instructions and the number of tenant cache instructions according to a preset decrementing method. The preset decrementing method is a method for decrementing the number of product cache instructions and the number of tenant cache instructions from the downlink instructions to a preset cache queue in a preset instruction cache. A preset instruction sender decrements the number of product cache instructions and the number of tenant cache instructions according to the target key value and a preset storage method. Specifically, the statements for accumulating the number of product cache instructions and the number of tenant cache instructions are: redis.decr(“count:T1”) and redis.decr(“count:T1 / P1”), where redis.desc() is a preset method for decrementing the target key value in this embodiment. By decrementing the number of product cache instructions and the number of tenant cache instructions according to the preset decrementing method, the number of product cache instructions and the number of tenant cache instructions are updated in real time, maintaining consistency with the current situation, thus facilitating the management of the number of product cache instructions and the number of tenant cache instructions.

[0047] S140. If any one of the device cache instruction count, the product cache instruction count, and the tenant cache instruction count reaches the corresponding preset instruction count threshold, the downlink instruction is intercepted, and the corresponding capacity threshold limit information is sent to the SAAS application.

[0048] In this embodiment, the capacity threshold restriction information is information sent by the platform to the SaaS application to restrict the sending of downlink commands. If the number of device cache commands, product cache commands, and tenant cache commands reaches their corresponding preset command quantity threshold, it means that the downlink command cannot be cached. Cached downlink commands may put pressure on the platform's storage capacity. Therefore, the command preprocessor intercepts the downlink command and will not push it to the device to be pushed. It also sends the corresponding capacity threshold restriction information to the SaaS application to remind the SaaS application not to send the corresponding downlink command. The downlink command will only be received and cached again after the device to be pushed logs in again and the number of cached commands is reduced. By intercepting the downlink commands and sending the corresponding capacity threshold restriction information to the SaaS application, the caching of massive downlink command data can be controlled, effectively alleviating the pressure on the platform's storage system.

[0049] To further understand the method for controlling IoT message caching instructions in this embodiment of the invention, the process is explained based on the flowchart:

[0050] like Figure 5As shown, a preset configuration manager pre-configures the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions, along with corresponding preset instruction number thresholds. If the preset instruction number threshold changes, a preset instruction preprocessor is immediately notified. When the SaaS sends a downlink instruction, the preset instruction preprocessor obtains the preset device, product, and tenant identifiers of the device to be pushed based on the downlink instruction issued by the SaaS application. Based on the preset device, product, and tenant identifiers and the preset preset cache calculation method, it retrieves the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions from the preset instruction cache, and obtains the preset instruction number threshold. The preset instruction preprocessor then determines the number of cached instructions and the number of product cache instructions. If the number of instructions reaches the corresponding preset instruction number threshold, and if the number of one cached instruction reaches its corresponding preset instruction number threshold, the preset instruction preprocessor intercepts the downlink instruction and sends the corresponding capacity threshold limit information to the SAAS application. If none of the downlink instructions reach the preset instruction number threshold, the preset instruction preprocessor sends the downlink instruction to the preset instruction sender. The downlink instruction is sent when the device is online, and stored in a preset cache queue when the device is offline. The downlink instructions in the preset cache queue are sent to the device to be pushed when the device logs in again. This achieves on-demand allocation of cache capacity thresholds based on different roles and alleviates the pressure on the platform's storage system, improves the performance of the platform in downlink scenarios, enhances the platform's reliability and stability, and reduces the platform's maintenance costs.

[0051] Figure 6 This is a schematic block diagram of an IoT message cache instruction quantity control device 200 provided in an embodiment of the present invention. Figure 6 As shown, corresponding to the above-described method for controlling the number of IoT message cache instructions, this invention also provides an IoT message cache instruction quantity control device. This IoT message cache instruction quantity control device includes a unit for executing the above-described method for controlling the number of IoT message cache instructions. This device can be configured in a desktop computer, tablet computer, laptop computer, or other terminal. Specifically, please refer to... Figure 6 The IoT message cache instruction quantity control device includes an acquisition unit 210, a calculation unit 220, a judgment unit 230, and an interception unit 240.

[0052] The acquisition unit 210 is used to acquire the product and tenant to which the device to be pushed belongs based on the downlink instruction sent to the device to be pushed if it receives the downlink instruction sent to the device to be pushed.

[0053] In one embodiment, the acquisition unit 210 includes an identification unit and an acquisition subunit.

[0054] The identification unit is used to obtain the preset product identifier and the preset tenant identifier of the device to be pushed according to the downlink instruction;

[0055] The acquisition sub-unit is used to acquire the product and the tenant to which the device to be pushed belongs based on the product identifier and the tenant identifier.

[0056] The calculation unit 220 is used to obtain the number of device cache instructions of the device to be pushed, the number of product cache instructions of the product, and the number of tenant cache instructions of the tenant according to the preset device identifier, the preset product identifier, the preset tenant identifier, and the preset cache calculation method.

[0057] In one embodiment, the computing unit 220 includes a primary key value unit, a target key value unit, and a computing subunit.

[0058] The primary key-value unit is used to obtain the primary key-value corresponding to the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions based on the preset device identifier, the preset product identifier, the preset tenant identifier, and the preset separator;

[0059] The target key value unit is used to concatenate the primary key values ​​using a preset concatenation character to obtain the corresponding target key value;

[0060] The calculation subunit is used to obtain the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions based on the target key value and the preset cache calculation method.

[0061] The judgment unit 230 is used to determine whether the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions have reached the corresponding preset instruction number threshold.

[0062] In one embodiment, the judgment unit 230 includes a judgment subunit and a storage unit.

[0063] The judgment subunit is used to determine whether the device to be pushed is online if the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions have not reached the corresponding preset instruction number threshold.

[0064] A storage unit is used to store the downlink instruction to the tail of a preset cache queue if the device to be pushed is offline.

[0065] In one embodiment, the determination unit 230 includes an accumulation unit, a detection unit, and a decrement unit.

[0066] The accumulation unit is used to accumulate the number of product cache instructions and the number of tenant cache instructions according to a preset storage method.

[0067] The detection unit is used to sequentially push the downlink instructions in the preset cache queue to the device to be pushed if it detects that the device to be pushed has logged in again.

[0068] The decrement unit is used to decrement the number of product cache instructions and the number of tenant cache instructions according to a preset decrement method.

[0069] The interception unit 240 is configured to intercept the downlink instruction and send the corresponding capacity threshold limit information to the SAAS application if any one of the device cache instruction number, the product cache instruction number, and the tenant cache instruction number reaches the corresponding preset instruction number threshold.

[0070] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned IoT message cache instruction quantity control device 200 and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.

[0071] The aforementioned IoT message cache instruction quantity control device can be implemented as a computer program, which can, for example... Figure 7 It runs on the computer device shown.

[0072] Please see Figure 7 , Figure 7 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 can be a terminal or a server. The terminal can be an electronic device with communication functions, such as a smartphone, tablet, laptop, desktop computer, personal digital assistant, or wearable device. The server can be a standalone server or a server cluster composed of multiple servers.

[0073] See Figure 7 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.

[0074] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to execute a method for controlling the number of IoT message cache instructions.

[0075] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.

[0076] The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute an Internet of Things message cache instruction quantity control method.

[0077] This network interface 505 is used for network communication with other devices. Those skilled in the art will understand that... Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0078] The processor 502 is used to run a computer program 5032 stored in a memory to implement the steps of the above method.

[0079] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, 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, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0080] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0081] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When executed by a processor, the program instructions cause the processor to perform the steps of the method described above.

[0082] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.

[0083] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0084] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0085] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0086] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0087] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for controlling the number of message caching instructions in the Internet of Things (IoT), characterized in that, include: If a downlink instruction is received and sent to the device to be pushed, the product and tenant to which the device to be pushed belong are obtained according to the downlink instruction; The number of device cache instructions for the device to be pushed, the number of product cache instructions for the product, and the number of tenant cache instructions for the tenant are obtained based on the preset device identifier, preset product identifier, preset tenant identifier, and preset cache calculation method. Determine whether the number of device cached instructions, the number of product cached instructions, and the number of tenant cached instructions have reached the corresponding preset instruction number threshold. If any of the device cache instruction count, the product cache instruction count, and the tenant cache instruction count reaches the corresponding preset instruction count threshold, the downlink instruction will be intercepted, and the corresponding capacity threshold limit information will be sent to the SAAS application. The step of obtaining the number of device cache instructions for the device to be pushed, the number of product cache instructions for the product, and the number of tenant cache instructions for the tenant based on a preset device identifier, a preset product identifier, a preset tenant identifier, and a preset cache calculation method includes: obtaining the primary key values ​​corresponding to the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions based on the preset device identifier, the preset product identifier, the preset tenant identifier, and a preset separator; concatenating the primary key values ​​using a preset concatenation character to obtain the corresponding target key value; and obtaining the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions based on the target key value and the preset cache calculation method. The number of device cache instructions is the cumulative value of downlink instructions received when the device is offline; the number of product cache instructions is the cumulative value of downlink instructions received by the product to which the device belongs; the number of tenant cache instructions is the cumulative value of downlink instructions received by the tenant to which the device belongs; the relationship between tenant and product is one-to-many, and the relationship between product and device is also one-to-many.

2. The method according to claim 1, characterized in that, After the step of determining whether the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions have reached the corresponding preset instruction number threshold, the method further includes: If the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions all fail to reach the corresponding preset instruction number threshold, then it is determined whether the device to be pushed is online. If the device to be pushed is offline, the downlink instruction is stored at the end of a preset cache queue.

3. The method according to claim 2, characterized in that, After the step of storing the downlink instruction to the tail of the preset buffer queue, the method further includes: The number of product cache instructions and the number of tenant cache instructions are accumulated according to a preset storage method.

4. The method according to claim 2, characterized in that, After the step of storing the downlink instruction to the tail of the preset buffer queue, the method further includes: If the device to be pushed is detected to log in again, the downlink instructions in the preset cache queue will be pushed to the device to be pushed in sequence.

5. The method according to claim 4, characterized in that, After the step of detecting that the device to be pushed has logged in again, the method further includes: The number of product cache instructions and the number of tenant cache instructions are reduced according to a preset reduction method.

6. The method according to claim 1, characterized in that, The steps of obtaining the product and tenant to which the device to be pushed belongs include: According to the downlink instruction, obtain the preset product identifier and the preset tenant identifier of the device to be pushed; The product and tenant to which the device to be pushed belongs are obtained based on the preset product identifier and the preset tenant identifier.

7. A device for controlling the number of message cache instructions in the Internet of Things, characterized in that, include: The acquisition unit is used to acquire the product and tenant of the device to be pushed according to the downlink instruction sent to the device to be pushed if it receives the downlink instruction sent to the device to be pushed. The calculation unit is configured to obtain the number of device cache instructions for the device to be pushed, the number of product cache instructions for the product, and the number of tenant cache instructions for the tenant based on a preset device identifier, a preset product identifier, a preset tenant identifier, and a preset cache calculation method; wherein, the step of obtaining the number of device cache instructions for the device to be pushed, the number of product cache instructions for the product, and the number of tenant cache instructions for the tenant based on the preset device identifier, the preset product identifier, the preset tenant identifier, and a preset cache calculation method includes: obtaining the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions based on the preset device identifier, the preset product identifier, the preset tenant identifier, and a preset separator. The primary key value corresponding to the number of tenant cache instructions is obtained; the primary key value is concatenated using a preset concatenation character to obtain the corresponding target key value; the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions are obtained according to the target key value and the preset cache calculation method; wherein, the number of device cache instructions is the cumulative value of the downlink instructions received when the device is offline, the number of product cache instructions is the cumulative value of the downlink instructions received by the product to which the device belongs, and the number of tenant cache instructions is the cumulative value of the downlink instructions received by the tenant to which the device belongs. The relationship between tenant and product is one-to-many, and the relationship between product and device is also one-to-many. The judgment unit is used to determine whether the number of device cache instructions, the number of product cache instructions, and the number of tenant cache instructions have reached the corresponding preset instruction number threshold. The interception unit is configured to intercept the downlink instruction and send the corresponding capacity threshold limit information to the SaaS application if any one of the device cache instruction count, the product cache instruction count, and the tenant cache instruction count reaches the corresponding preset instruction count threshold.

8. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-6.

9. A storage medium, characterized in that, The storage medium stores a computer program, which includes program instructions that, when executed by a processor, can implement the method as described in any one of claims 1-6.