Generation management method for API (Application Program Interface)

The adaptive caching management for APIs addresses cache security issues by dynamically adjusting caching strategies based on active API balance and requestor behavior, enhancing security and efficiency.

CN120315784AActive Publication Date: 2025-07-15北京科杰科技有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510765053.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-07-15
Estimated Expiration
2045-06-10

AI Technical Summary

Technical Problem

Although the API caching method in the prior art improves the response speed, it fails to effectively protect the security of front-end cached data, which can easily lead to cached information leakage.

Method used

By determining the target call status based on the active equalization degree and call interval of the active API, adjusting the cache cleaning cycle or mechanism and scale, and combining the sensitive information status and the requester's operation characteristics hazard coefficient, selecting circular cache or specific gravity cache for encryption or hidden processing.

Benefits of technology

It improves the efficiency and security of API generation and management, avoids cache information leakage, enhances data security, and adapts to the cache effect of dynamic scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120315784A_ABST
    Figure CN120315784A_ABST
Patent Text Reader

Abstract

The invention provides a generation management method for an API (Application Program Interface), which comprises the following steps of: determining a target calling state according to an active balance degree and a calling interval degree of an active API, and determining a cache adjustment mode according to the target calling state to adjust a cache cleaning period, or set a cache mechanism or adjust a cache scale; when the cache mechanism is set, the sensitive information state is detected, and whether the cache mechanism is cyclic cache or specific gravity cache is determined according to the sensitive information state; when the cache scale is adjusted, an early warning score is determined according to the operation characteristic danger coefficient of the target requester, and proportional adjustment or conventional adjustment for the cache scale is determined according to a comparison result of the early warning score and a preset early warning score; and in proportion adjustment, according to the comparison result of the hierarchical diversity value and the preset hierarchical diversity value, the API front-end cache is determined to be encrypted or hidden. According to the method and the device, the API generation management efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data management, and in particular to a method for generating and managing APIs. Background Art

[0002] An API (Application Programming Interface) is a software intermediate layer that allows different programs, systems, or services to interact and communicate. It defines a set of rules, protocols, and tools for building or integrating software applications. Malicious programs calling APIs is a common attack method. Attackers use the API interfaces provided by the operating system, application programs, or third-party libraries to achieve malicious functions, such as stealing data, controlling the system, spreading malware, etc. In the prior art, in order to avoid the problem of poor time efficiency caused by repeated API calls, a cache module is often set up to cache the request data corresponding to the API. Although the time loss caused by repeated calls is reduced, the risk of malicious program attacks is also increased, and it is easy to cause cache information leakage. Therefore, how to effectively perform data caching while protecting the security of API call information is a technical problem that needs to be solved by those skilled in the art.

[0003] Chinese Patent Publication No. CN117472952A discloses a method and system for caching API interfaces. The method includes the following steps: caching pre-configured or post-configured API interfaces; caching the return values of legitimate interfaces, and at the same time, effectively refreshing the data according to a timed refresh or manual refresh strategy; caching the data into a hybrid database including but not limited to relational databases, NoSql, graph databases, time series databases, or a combination of different types of databases. It can be seen that the above technical solution has the following problems: although it can improve the response speed of API interfaces, it does not consider the security protection of API-related data cached by the front end, and it is easy to cause front-end cache information leakage. Summary of the Invention

[0004] Therefore, the present invention provides a method for generating and managing APIs to overcome the problem that although the API caching method in the prior art improves the response speed of API interfaces, it does not consider the security protection of API-related data cached by the front end, and it is easy to cause front-end cache information leakage.

[0005] To achieve the above object, the present invention provides a method for generating and managing APIs, including: Determine the target call status according to the activity balance degree and call interval degree of active APIs, and determine the cache adjustment method according to the target call status to adjust the cache cleaning cycle, or set the cache mechanism or adjust the cache scale; When setting the caching mechanism, detect the sensitive information status and determine the caching mechanism as circular caching or proportional caching according to the sensitive information status; When adjusting the cache scale, determine the warning score according to the operation characteristic risk coefficient of the target requester, and determine whether to perform proportional adjustment or normal adjustment on the cache scale according to the comparison result between the warning score and the preset warning score; In the proportional adjustment, determine whether to encrypt or hide the API front-end cache according to the comparison result between the hierarchical diversity value and the preset hierarchical diversity value.

[0006] Further, determine the target call status according to the activity balance degree and call interval degree of the active APIs, and determine the cache adjustment method according to the target call status; If the target call status is that the activity balance degree is less than the preset activity balance degree and the call interval degree is less than the preset call interval degree, the cache adjustment method is to adjust the cache cleaning period; If the target call status is that the activity balance degree is greater than or equal to the preset activity balance degree or the call interval degree is greater than or equal to the preset call interval degree, the cache adjustment method is to set the caching mechanism or adjust the cache scale.

[0007] Further, under the condition of mechanism adjustment, when setting the caching mechanism, it includes: Detect the sensitive information status and determine the caching mechanism according to the sensitive information status; If the sensitive information status is that the retrieval bias degree is greater than the preset retrieval bias degree or the information relevance degree is greater than the preset information relevance degree, the caching mechanism is set as circular caching; If the sensitive information status is that the retrieval bias degree is less than or equal to the preset retrieval bias degree and the information relevance degree is less than or equal to the preset information relevance degree, the caching mechanism is set as proportional caching.

[0008] Further, the circular caching includes: Generate several API combinations according to the information relevance degree of the active APIs. Each API combination includes two active APIs, and the information relevance degree corresponding to the two active APIs is the maximum information relevance degree corresponding to at least one of the active APIs; At the same moment, only one active API in any API combination performs front-end caching.

[0009] Further, a caching period is set in the circular caching, and the duration of a single caching period is determined according to the bias degree difference; The duration of the caching period and the bias degree difference are in a positive correlation; The bias degree difference is the difference between the retrieval bias degree and the preset retrieval bias degree.

[0010] Further, the proportion cache includes: Determine the proportion coefficients of each active API according to the collocation usage frequency and activity; Detect the proportion coefficients of each active API and sort them in descending order according to the proportion coefficients to obtain a proportion sequence. Periodically select a preset number of active APIs and corresponding frequency-related APIs in descending order of the proportion coefficients for front-end caching; The proportion coefficient of the API is positively correlated with both the API collocation usage frequency and the activity.

[0011] Further, under the condition of scale adjustment, perform a risk analysis on the operation behavior of the target requester, including: Detect the operation feature risk coefficient of the target requester; Determine the warning score according to the operation feature risk coefficient of the target requester; If the warning score is greater than the preset warning score, perform a proportional adjustment on the cache scale; If the warning score is less than or equal to the preset warning score, perform a conventional adjustment on the cache scale.

[0012] Further, the operation feature risk coefficient is determined according to the trajectory similarity and the key input similarity; The feature risk coefficient is positively correlated with both the trajectory similarity and the key input similarity; The trajectory similarity is determined according to the trajectory movement frequency and the number of times of trajectory disconnection; The key input similarity is determined according to the unified proportion of keywords.

[0013] Further, the proportional adjustment of the cache scale includes: Obtain the warning score difference, and determine the hidden proportion according to the obtained score difference; The hidden proportion is positively correlated with the warning score difference; Perform a hierarchical diversity analysis on each active API to obtain a hierarchical diversity value. If the hierarchical diversity value is less than the preset hierarchical diversity value, encrypt the front-end cache of the API with the hidden proportion; If the hierarchical diversity value is greater than or equal to the preset hierarchical diversity value, hide the front-end cache of the API with the hidden proportion.

[0014] Further, the conventional adjustment of the cache scale includes: Encrypt the front-end cache of the APIs with the conventional proportion.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows. In the technical solution of the present invention, the target call status is determined according to the activity balance degree and call interval degree of active APIs. The target call status effectively reflects the balance degree of the call times of current APIs and the density degree of call moments, and the cache adjustment method is determined according to the target call status, making the selection of the cache adjustment method more in line with the actual working scenario, avoiding the problem of poor actual cache effect caused by the inability of the single cache processing method in the prior art to adapt to dynamic scenarios, and thus improving the API generation management efficiency.

[0016] Furthermore, when setting the cache mechanism in the technical solution of the present invention, the sensitive information status is detected and the cache mechanism is determined according to the sensitive information status; the cache mechanism is selected according to the distribution of sensitive information corresponding to APIs in the actual scenario and the correlation degree of information corresponding to each API, taking into account the security of cached information. The selectable cache mechanism enhances the security of cached information, avoids the leakage of cached information, and thus improves the API generation management efficiency.

[0017] Furthermore, in the technical solution of the present invention, the warning score is determined according to the operation characteristic risk coefficient of the target requester. When the warning score is greater than the preset warning score, the cache scale is adjusted proportionally. By analyzing the mouse operation behavior and information input behavior of the target requester to obtain the operation characteristic risk coefficient, the actual operation behavior of the target requester characterizes the risk of malicious software malicious attack, avoiding the problem of information theft through multiple IDs or malicious programs, and improving the data security of the cached data of the API.

[0018] Furthermore, in the technical solution of the present invention, a cache mechanism of circular cache is set. The cached data of the current cache is periodically changed through circular cache to avoid the cached data being attacked. A number of API combinations are generated according to the information correlation degree of active APIs. The information correlation degree reflects the correlation degree between APIs, and moreover, only one active API exists in any one API combination for front-end caching, further enhancing the security management of the API. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a schematic diagram of the method for API generation management of the present invention; Figure 2 is a flowchart of determining the cache adjustment method according to the target call status of the present invention; Figure 3 is a flowchart of determining the cache mechanism according to the sensitive information status of the present invention; Figure 4 is a flowchart of determining proportional adjustment or normal adjustment of the cache scale according to the warning score of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] In order to make the objectives and advantages of the present invention more clear and understandable, the present invention will be further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0021] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present invention and do not limit the protection scope of the present invention.

[0022] It should be noted that in the description of the present invention, the terms indicating directions or positional relationships such as "upper", "lower", "left", "right", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings. This is only for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention.

[0023] In addition, it should also be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installation", "connection", and "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.

[0024] Please refer to Figures 1 to 4 As shown, the present invention provides a method for generating and managing APIs, including: Determine the target call status according to the activity balance degree and call interval degree of active APIs, and determine the cache adjustment method according to the target call status to adjust the cache cleaning cycle, or set the cache mechanism or adjust the cache scale; When setting the cache mechanism, detect the sensitive information status and determine the cache mechanism as a cyclic cache or a proportion cache according to the sensitive information status; When adjusting the cache scale, determine the warning score according to the operation characteristic risk coefficient of the target requester, and determine whether to perform proportional adjustment or conventional adjustment on the cache scale according to the comparison result between the warning score and the preset warning score; In the proportional adjustment, determine whether to encrypt or hide the API front-end cache according to the comparison result between the hierarchical diversity value and the preset hierarchical diversity value.

[0025] The present invention is applied to the cache generation management of APIs. In the present invention, a target requester can send an API request to an API server through a client (such as a browser) to request an API call. The client is provided with a storage module for performing front-end caching on the request result of the API request. This is content that is easily understood by those skilled in the art and will not be elaborated here. The target requester is the user who makes an API request for the current client. The present invention also correspondingly has management personnel for managing the API server, such as managing the configuration of APIs in the API server.

[0026] The present invention has historical records. A single historical record includes at least active balance degree, call interval degree, retrieval bias degree, information relevance degree, collocation frequency, activity degree, and warning score. And the historical record is correspondingly provided with a qualified mark, which records whether the historical record meets the requirements of the management personnel. Among them, determining whether a historical record meets the requirements of the management personnel can be, but is not limited to, determined according to the retrieval processing speed. Determining whether a historical record meets the requirements of the management personnel according to the retrieval processing speed index set by the management personnel is content that those skilled in the art have mastered and will not be limited here.

[0027] Specifically, determine the target call status according to the active balance degree and call interval degree of the active APIs, and determine the cache adjustment method according to the target call status; If the target call status is that the active balance degree is less than the preset active balance degree and the call interval degree is less than the preset call interval degree, the cache adjustment method is to adjust the cache cleaning cycle; If the target call status is that the active balance degree is greater than or equal to the preset active balance degree or the call interval degree is greater than or equal to the preset call interval degree, the cache adjustment method is to set the cache mechanism or adjust the cache scale.

[0028] An active API is an API whose number of API requests in the most recent monitoring cycle is greater than the preset number. The present invention is provided with a cyclic monitoring cycle, and the determination of the cache adjustment method is performed at the end of each monitoring cycle. Among them, if the number of active APIs is less than or equal to 1, there is no need to determine the target call status and wait for the end of the next monitoring cycle. The duration of a single monitoring cycle is set by the management personnel. The greater the determination accuracy of the management personnel for the active APIs, the greater the duration of the monitoring cycle. Provide a duration of the monitoring cycle. The duration of the monitoring cycle is 15 minutes. The value of the preset number can be set by the management personnel according to the actual application scenario. It can be understood that the greater the security management requirements of the management personnel for the APIs, the smaller the value of the preset number. Provide a way to obtain the value of the preset number. Denote the average value of the number of API requests in the most recent monitoring cycle for each API that has been made an API request in the most recent monitoring cycle as the preset number; The active balance degree is denoted as S. All active APIs are randomly sorted, and the number of API requests made during the most recent monitoring period corresponding to the i-th active API is denoted as Si, and S0 is the average value of the number of API requests made during the most recent monitoring period corresponding to the active APIs. i = 1, 2, 3, ……, n, where n is the total number of active APIs.

[0029] The call interval degree is the call time corresponding to each active API during the most recent monitoring period. The call times are arranged in ascending order of time, and the average value of the time intervals between adjacent call times is denoted as the call interval degree. The call time is the time corresponding to making an API request to the API server for an active API. The values of the preset active balance degree and the preset call interval degree can be set by the management personnel according to the actual application scenario. It can be understood that the present invention effectively characterizes the frequency of API calls in terms of time and frequency through the active balance degree and the call interval degree. The values of the preset active balance degree and the preset call interval degree reflect the security management requirements of the management personnel for the API. The greater the security management requirements of the management personnel for the API, the smaller the values of the preset active balance degree and the preset call interval degree. A method for obtaining the values of the preset active balance degree and the preset call interval degree is provided, which extracts the active balance degree and the call interval degree corresponding to the historical records that meet the requirements of the management personnel, removes the outliers therein, and respectively denotes the average values of the active balance degree and the call interval degree after removing the outliers as the preset active balance degree and the preset call interval degree. The method for removing outliers can be selected according to the actual situation, such as the standard deviation method (3σ principle) and the IQR method, but is not limited to the above methods for removing outliers.

[0030] Specifically, the cache mechanism is set as follows: Detect the sensitive information status and determine the cache mechanism according to the sensitive information status; If the sensitive information status is that the retrieval bias degree is greater than the preset retrieval bias degree or the information relevance degree is greater than the preset information relevance degree, the cache mechanism is set as a circular cache; If the sensitive information status is that the retrieval bias degree is less than or equal to the preset retrieval bias degree and the information relevance degree is less than or equal to the preset information relevance degree, the cache mechanism is set as a proportion cache.

[0031] The confirmation method of the retrieval bias degree is to detect the sensitive coefficient corresponding to each active API during the most recent monitoring period, and denote the average value of the sensitive coefficients as the retrieval bias degree; For a single active API, the confirmation method of its corresponding sensitivity coefficient is to detect the proportion of sensitive data in the request results corresponding to each API request for this active API within the most recent monitoring period, calculate the average value of the sensitive data proportion, and detect the similarity of sensitive data in the request results corresponding to each API request. The sensitivity coefficient = (average value of sensitive data proportion / preset average value of sensitive data proportion) + (similarity of sensitive data / preset similarity of sensitive data); The average value of the sensitive data proportion reflects the data sensitivity degree of the request results as a whole, and the similarity of sensitive data reflects the retrieval similarity among the request results. Managers can set the values of the preset average value of sensitive data proportion and the preset similarity of sensitive data according to actual needs. It can be understood that the greater the security requirements of managers for the sensitive data of the request results, the smaller the preset average value of sensitive data proportion and the smaller the preset similarity of sensitive data. A set of values is provided: the preset average value of sensitive data proportion is 35%, and the preset similarity of sensitive data is 15.

[0032] For a single request result, analyze all fields in the request result, and record the sensitive data proportion as the number of sensitive fields / total number of fields. The presentation form of the request results in the present invention is JSON or XML data, and the sensitive fields are marked in advance by managers. It can be understood that managers can set their own data classification criteria according to their attention to each API and related data, so as to determine which fields are sensitive fields; For a single active API, the confirmation method of the similarity of sensitive data is to extract the sensitive data in the request results returned by this active API within the most recent monitoring period, detect the sensitive fields with the number of occurrences greater than the preset number of occurrences, and record the number of sensitive fields with the number of occurrences greater than the preset number of occurrences as the similarity of sensitive data. For example, within the most recent monitoring period, there are 5 sensitive fields in the result of the API returning to the northern region whose number of occurrences exceeds the preset number of occurrences, then the similarity of sensitive data is 5. It can be understood that the greater the attention of managers to sensitive fields, the smaller the value of the preset number of occurrences. A set of values of the preset number of occurrences is provided: the preset number of occurrences is 5 times.

[0033] Detect each active API corresponding to the most recent monitoring period. The confirmation method of information relevance is to detect the co-update events of each active API (the number of active APIs is at least 2) within a preset update duration (regardless of whether the active APIs remain in the active API state during the preset update duration). Record the number of co-update events as the information relevance. The co-update event means that there are at least two active APIs for update and the duration between the timestamps corresponding to the updates is less than the preset delay duration. Among them, the greater the demand of the management personnel for the determination accuracy of information relevance, the greater the preset update duration and the greater the preset delay duration. How the API is updated and the timestamp marking of the update moment are all content that those skilled in the art have mastered and will not be elaborated here. The preset update duration is the duration before the current moment. That is, if the preset update duration is 100h, count the co-update events within the 100h before the current moment.

[0034] For the values of the preset retrieval bias degree and the preset information relevance, the management personnel can set them according to the actual application scenario. It can be understood that the present invention preset the values of the retrieval bias degree and the information relevance by the correlation degree and sensitivity between the results of each request of the retrieval bias degree and the information relevance, which reflects the security management requirements of the management personnel for the API. The greater the security management requirements of the management personnel for the API, the smaller the values of the preset retrieval bias degree and the preset information relevance. Provide a method for presetting the values of the retrieval bias degree and the information relevance, extract the retrieval bias degree and information relevance corresponding to the historical records that meet the requirements of the management personnel, remove the outliers among them, and record the respective averages of the retrieval bias degree and information relevance after removing the outliers as the preset retrieval bias degree and the preset information relevance.

[0035] Specifically, the circular cache includes: Generate several API combinations according to the information relevance of the active APIs. Each single API combination includes two active APIs and the information relevance corresponding to the two active APIs is the maximum information relevance corresponding to at least one of the active APIs. At the same moment, only one active API within any one API combination performs front-end caching.

[0036] It can be understood that the process of generating several API combinations includes performing combined analysis on each active API in turn according to the order of the sensitivity coefficient from large to small. The combined analysis for a single active API includes detecting the active API corresponding to the maximum information relevance of this active API that has not been included in the API combination, and recording these two active APIs as an API combination. If the number of active APIs corresponding to the maximum information relevance is 2, randomly select any one of them to be included in the combination.

[0037] When performing front - end caching for an active API, the request results returned by the active API in the most recent three times are stored in the storage module of the client.

[0038] Specifically, a caching period is set in the cyclic cache, and the duration of a single caching period is determined according to the deviation difference; The duration of the caching period and the deviation difference have a positive correlation; The deviation difference is the difference between the retrieved deviation and the preset retrieved deviation.

[0039] Preferably, in the specific implementation of the present invention, the duration of a single caching period = reference duration × [1+(deviation difference / preset retrieved deviation)]. The value of the reference duration can be set by the administrator according to the maximum caching capacity of the actual front - end caching. The larger the maximum caching capacity, the larger the reference duration. A value of the reference duration is provided, and the reference duration is 8 min.

[0040] For two active APIs within any API combination, the front - end caching duration for each active API is the caching period. For example, for two active APIs within an API combination, they are randomly denoted as API - A and API - B respectively. Randomly select any one API to be cached in the storage module of the client first. After the caching period, replace it with API - B to be cached in the storage module of the client, and repeat the above actions; deviation difference = retrieved deviation - preset retrieved deviation.

[0041] Specifically, the proportion caching includes: Determine the proportion coefficients of each active API according to the collocation usage frequency and activity; Detect the proportion coefficients of each active API and arrange them in descending order according to the proportion coefficients to obtain a proportion sequence. Periodically select a preset number of active APIs and the corresponding frequency - related APIs in descending order of the proportion coefficients for front - end caching; The proportion coefficient of the API has a positive correlation with both the API collocation usage frequency and the activity.

[0042] Proportion coefficient = (Frequency of combined use / Preset frequency of combined use) + (Activity / Preset activity), where the activity of an active API is the number of API requests made to the active API in the most recent monitoring period. For a single active API, the method for determining the frequency of combined use of the active API is as follows: Denote the active API as the target active API, detect the number of combined active APIs corresponding to the target active API, and denote the number of combined active APIs as the frequency of combined use of the target active API. A combined active API is an active API whose number of combinations with the target active API in the most recent monitoring period is greater than the preset number of combinations. The method for determining the number of combinations is as follows: If, in the most recent monitoring period, the time interval between a corresponding API request of the target active API and a corresponding API request of the combined active API is less than the preset time interval, it is recorded as one combination. It can be understood that the greater the number of combinations, the greater the probability of initiating API requests simultaneously. Therefore, the greater the management's requirement for the API request processing speed, the smaller the value of the preset number of combinations. A value for the preset number of combinations is provided, and the preset number of combinations is 3. The API corresponding to the frequency-related API is the combined active API with the largest number of combinations corresponding to the API.

[0043] For the values of the preset frequency of combined use and the preset activity, the management personnel can set them according to the actual application scenario. A value for the preset frequency of combined use and the preset activity is provided. Extract the frequency of combined use and the activity corresponding to the historical records that meet the management's requirements, remove the outliers among them, and denote the average values of the frequency of combined use and the activity after removing the outliers as the preset frequency of combined use and the preset activity, respectively.

[0044] Specifically, a risk analysis is performed on the operation behavior of the target requester, including: Detect the risk coefficient of the operation characteristics of the target requester; Determine the warning score based on the risk coefficient of the operation characteristics of the target requester; If the warning score is greater than the preset warning score, adjust the proportion of the cache size; If the warning score is less than or equal to the preset warning score, perform a regular adjustment on the cache size.

[0045] Specifically, the risk coefficient of the operation characteristics is determined based on the trajectory similarity and the key input similarity; The risk coefficient of the characteristics has a positive correlation with both the trajectory similarity and the key input similarity. A calculation method for the risk coefficient of the characteristics is provided, and the risk coefficient of the characteristics = trajectory similarity × β1 + key input similarity × β2; The trajectory similarity is determined based on the trajectory movement frequency and the number of trajectory disconnections; The key input similarity is determined according to the unified proportion of keywords.

[0046] Among them, for the value of the preset warning score, the management personnel can set it according to the actual scenario. It can be understood that the greater the management personnel's demand for data security, the smaller the value of the preset warning score. A method for obtaining the value of the preset warning score is provided. Extract the warning scores corresponding to the historical records that meet the management personnel's needs, remove the outliers among them, and record the average value of the warning scores after removing the outliers as the preset warning score.

[0047] β1 is the first similarity weight, and β12 is the second similarity weight. The values of β1 and β2 can be set according to the actual scenario. It can be understood that, for example, the greater the management personnel's emphasis on the trajectory similarity, the greater the value of β1. β1 + β2 = 1, and both β1 and β2 are greater than 0. A value is provided: β1 = 0.7, β2 = 0.3. The confirmation method of the trajectory similarity is as follows: Extract the sub-trajectory similarity between the target requester and the relevant target requester in the most recent monitoring period, and record the maximum value of the sub-trajectory similarity as the trajectory similarity. The confirmation method of the sub-trajectory similarity between the target requester and any relevant target requester is as follows: Extract the mouse operation trajectories of the target requester and the relevant target requester in the most recent monitoring period. For the minimum circumscribed rectangle area, the number of inflection points, and the residence duration of each mouse operation trajectory, calculate the absolute value H1 of the difference in the minimum circumscribed rectangle areas corresponding to the two mouse operation trajectories, the absolute value H2 of the difference in the number of inflection points, and the absolute value H3 of the difference in the residence duration. The sub-trajectory similarity = H1×α1 + H1×α2 + H1×α3. α1 is the first weight coefficient, α2 is the second weight coefficient, and α3 is the third weight coefficient. The values of α1, α2, and α3 can be set according to the actual scenario. It can be understood that, for example, the greater the management personnel's emphasis on the similarity degree of the minimum circumscribed rectangle area, the greater the value of α1. α1 + α2 + α3 = 1, and α1, α2, and α3 are all greater than 0. A value is provided: α1 = 0.4, α2 = 0.3, α3 = 0.3. The inflection point of the mouse trajectory refers to the point where the movement direction changes significantly in the trajectory. The determination method of the inflection point provided by the present invention is that the curvature at the inflection point is greater than the curvature at any point on the adjacent line segment. The adjacent line segment is a trajectory segment with a length of 5 cm centered on the inflection point. It should be noted that the confirmation method of the inflection point is not unique, and it only needs to represent that the movement direction of the inflection point of the mouse trajectory changes significantly. The residence duration is the total duration during which the mouse remains stable and stationary.

[0048] The confirmation method of key input similarity is to extract the sub-key input similarity between the target requester and the relevant target requesters within the most recent monitoring period, and record the maximum value of the sub-key input similarity as the key input similarity. The confirmation method of the sub-key input similarity between the target requester and any relevant target requester is to extract the cross-region input speeds of the target requester and the relevant target requester within their respective most recent monitoring periods, and record the absolute value of the difference between the corresponding cross-region input speeds of the target requester and the relevant target requester as the sub-key input similarity. The cross-region input speed is the number of cross-region inputs within the monitoring period divided by the monitoring period duration. A key position with an interval distance greater than the preset interval distance between two adjacent key positions in the input order is recorded as one cross-region input. Among them, the interval distance between any two key positions is set in advance. That is, the management staff sets the interval distance between A and S keys to 1, and the interval distance between A and D keys to 2. That is, the size relationship of the interval distance should satisfy the size relationship of the actual keyboard, and there is no need to specifically limit a certain value. For example, the management staff sets the interval distance between A and S keys to 2, and the interval distance between A and D keys to 3, and the technical solution of the present invention can also be realized.

[0049] Specifically, the proportional adjustment of the cache scale includes: Obtain the early warning score difference, and determine the hidden ratio according to the obtained score difference; The hidden ratio has a positive correlation with the early warning score difference; Conduct hierarchical diversity analysis on each active API to obtain the hierarchical diversity value. If the hierarchical diversity value is less than the preset hierarchical diversity value, encrypt the API front-end cache with the hidden ratio; If the hierarchical diversity value is greater than or equal to the preset hierarchical diversity value, hide the API front-end cache with the hidden ratio.

[0050] The early warning score difference is the absolute value of the difference between the early warning score and the preset early warning score; Hidden ratio = normal ratio + early warning score difference / preset early warning score. The units of both the normal ratio and the hidden ratio are %. The API hierarchical diversity value is the number of different active APIs among the active APIs requested by the target requester and all corresponding relevant target requesters. For the API front-end cache with the hidden ratio, that is, randomly select the APIs with the hidden ratio among the active APIs requested by the target requester and all corresponding relevant target requesters for hiding. The hiding means not performing front-end caching.

[0051] Specifically, the normal adjustment of the cache scale includes: Encrypt the API front-end cache with the normal ratio.

[0052] The specific encryption method is not limited and may be, but is not limited to, symmetric encryption such as AES (Advanced Encryption Standard), RSA asymmetric encryption, and desensitization encryption of sensitive fields; For the value of the conventional ratio, the management personnel can set it according to the actual scenario. It can be understood that the greater the management personnel's demand for data security, the smaller the value of the conventional ratio; the greater the management personnel's demand for data retrieval efficiency, the greater the conventional ratio. A value of the conventional ratio is provided, and the conventional ratio is 50%.

[0053] So far, the technical solution of the present invention has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present invention.

[0054] The above are only the preferred embodiments of the present invention and are not used to limit the present invention; for those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A generation management method for APIs, characterized in that, Including: Determine the target call status according to the active balance degree and call interval degree of the active API, and determine the cache adjustment method according to the target call status, which is to adjust the cache cleaning cycle, or set the cache mechanism or adjust the cache scale; When setting the cache mechanism, detect the sensitive information status and determine the cache mechanism as circular cache or proportion cache according to the sensitive information status; When adjusting the cache scale, determine the warning score according to the operation characteristic risk coefficient of the target requester, and determine the proportional adjustment or regular adjustment for the cache scale according to the comparison result between the warning score and the preset warning score; In the proportional adjustment, determine whether to encrypt or hide the API front-end cache according to the comparison result between the hierarchical diversity value and the preset hierarchical diversity value.

2. The generation management method for API according to claim 1, wherein Determine the target call status according to the active balance degree and call interval degree of the active API, and determine the cache adjustment method according to the target call status; If the target call status is that the active balance degree is less than the preset active balance degree and the call interval degree is less than the preset call interval degree, the cache adjustment method is to adjust the cache cleaning cycle; If the target call status is that the active balance degree is greater than or equal to the preset active balance degree or the call interval degree is greater than or equal to the preset call interval degree, the cache adjustment method is to set the cache mechanism or adjust the cache scale.

3. The generation management method for APIs according to claim 2, characterized in that, Under the condition of mechanism adjustment, set the cache mechanism, including: Detect the sensitive information status and determine the cache mechanism according to the sensitive information status; If the sensitive information status is that the retrieval bias degree is greater than the preset retrieval bias degree or the information relevance degree is greater than the preset information relevance degree, the cache mechanism is set as circular cache; If the sensitive information status is that the retrieval bias degree is less than or equal to the preset retrieval bias degree and the information relevance degree is less than or equal to the preset information relevance degree, the cache mechanism is set as proportion cache.

4. The generation management method for API according to claim 3, characterized in that The circular cache includes: Generate several API combinations according to the information relevance degree of the active API, and each API combination includes two active APIs, and the information relevance degrees corresponding to the two active APIs are the maximum information relevance degrees corresponding to at least one of the active APIs; At the same moment, only one active API in any API combination is used for front-end cache.

5. The generation management method for API according to claim 4, characterized in that, A cache cycle is set in the circular cache, and the duration of a single cache cycle is determined according to the bias difference; The duration of the cache cycle has a positive correlation with the bias difference; The bias difference is the difference between the retrieval bias degree and the preset retrieval bias degree.

6. The generation management method for API according to claim 5, wherein, The proportion cache includes: Determine the proportion coefficient of each active API according to the collocation usage frequency and activity; Detect the proportion coefficients of each active API and arrange them in descending order according to the proportion coefficients to obtain a proportion sequence, and periodically select the preset proportion number of active APIs and the corresponding frequency-related APIs for front-end cache in descending order of the proportion coefficients; The proportion coefficient of the API has a positive correlation with both the API collocation usage frequency and the activity.

7. The generation management method for API according to claim 6, characterized in that, Under the condition of scale adjustment, conduct a risk analysis on the operation behavior of the target requester, including: Detect the operation characteristic risk coefficient of the target requester; Determine the warning score according to the operation characteristic risk coefficient of the target requester; If the warning score is greater than the preset warning score, adjust the cache scale proportionally; If the warning score is less than or equal to the preset warning score, perform a conventional adjustment on the cache scale.

8. The generation management method for API according to claim 7, wherein, The operation characteristic risk coefficient is determined according to the trajectory similarity and the key input similarity; The characteristic risk coefficient has a positive correlation with both the trajectory similarity and the key input similarity; The trajectory similarity is determined according to the trajectory movement frequency and the number of times of trajectory disconnection; The key input similarity is determined according to the unified proportion of keywords.

9. The generation management method for API according to claim 8, wherein, Performing a proportional adjustment on the cache scale includes: Obtain the warning score difference, and determine the hidden proportion according to the obtained score difference; The hidden proportion has a positive correlation with the warning score difference; Perform hierarchical diversity analysis on each active API to obtain the hierarchical diversity value. If the hierarchical diversity value is less than the preset hierarchical diversity value, encrypt the API front-end cache with the hidden proportion; If the hierarchical diversity value is greater than or equal to the preset hierarchical diversity value, hide the API front-end cache with the hidden proportion.

10. The generation management method for an API according to claim 9, characterized in that, Performing a conventional adjustment on the cache scale includes: Encrypt the API front-end cache with the conventional proportion.

Citation Information

Patent Citations

  • Power data prefetching and caching method with active defense influence range

    CN112561197A

  • Data caching time setting method and device, computer equipment and storage medium

    CN114327672A

  • Cache management method and device, storage medium and electronic equipment

    CN115334158A

  • Data caching method and device, equipment and medium

    CN118568137A

  • Method and apparatus for aquiring dynamic message

    US20150324463A1