The quick method for subscribing of data and device
Technical field
The present invention relates to communication data comprehensive management technology field, particularly relate to data and quickly subscribe to
Method and device.
Background technology
Along with the development of communication technology and the transformation of the idea in management of common carrier, network
Operation management progressively moves towards centralization from dispersion.Network centralization management is mainly reflected in two sides
Face, one be management region centralization, be in the past with branch company of districts and cities be monitored managing progressively to
Save, group company carries out unified monitoring maintenance;Two is management equipment scope centralization, by originally
Each specialty, a set of webmaster of producer progressively collect to the carrying out of full specialty one comprehensive network management of the whole network
Middleization.
But along with the centralized management of network, bring many challenges, particularly alarm management.
Will full specialty the whole network management, alarm amount can be caused huge, relevant alarm client real-time in
Now it is processed into a problem compeling highly necessary to solve.
Traditional mode is based on relevant database, according to conditional combination when interface presents data
Becoming relevant SQL statement, the data directly inquiring correspondence from data base present.Should
Method there is problems in that 1, treatment effeciency depends directly on data base, when data base's pressure
Comparison is presented slow time bigger.2, the quantity of client can affect the performance of data base, accesses
Client the most, the pressure of data base is the biggest.2, very flexible, is limited to the language of SQL
Sentence, and between distinct type data-base, SQL statement can be variant.
Summary of the invention
For above-mentioned technical problem, an object of the present invention is to provide a kind of data quickly to order
Readding method, it is independent of disk, uses physical memory buffered data, and access efficiency is high.
The two of the purpose of the present invention are to provide a kind of data quickly to subscribe to device, and it is used for realizing
An object of the present invention.
One of for achieving the above object, the present invention adopts the following technical scheme that
The quick method for subscribing of data, is applied in the processor of service end, has thing in service end
Reason internal memory and disk, comprise the steps:
Step one: receiving the subscription from client and ask, described subscription request includes data strip
Part and subscription attribute;
Step 2: whether be present in thing according to data qualification and subscription this subscription of attributive judgment request
In reason internal memory, the most then will be stored in physical memory and the subscription corresponding with this subscription request
Data send to client, otherwise, perform step 3;
Step 3: the data qualification asked according to this subscription and subscription attribute process from disk
To subscribing to data, this subscription request is added to physical memory, and data storage will be subscribed to
To physical memory, and these subscription data are sent to client.
Preferably, described physical memory is provided with a subscription table,
Described physical memory is provided with a subscription table, in described step 2 " according to data qualification and
Subscribe to whether this subscription of attributive judgment request is present in physical memory " it is specially according to data strip
Whether part and subscription this subscription of attributive judgment request are present in subscription table;In described step 3
" add this subscription request to physical memory " to be specially and this subscription request is added to subscribing to
In table.
Preferably, described data qualification is a Boolean expression, and this Boolean expression includes at least
One relational expression, described relational expression includes field, operator, correction data, right
Than part and additional information.
Preferably, described subscription attribute includes ID, subscribes to duration, field attribute, complete
One or more in portion's subscription, part subscription, subscription sequence and paging information.
Preferably, described subscription sequence includes needing sort field and sort type, described sequence class
Type includes ascending order and descending;Described paging information includes starting quantity and terminates quantity.
Two for achieving the above object, the present invention adopts the following technical scheme that
Data quickly subscribe to device, are applied in the processor of service end, have thing in service end
Reason internal memory and disk, including such as lower unit:
Receive unit: asking for receiving the subscription from client, described subscription request includes
Data qualification and subscription attribute;
Judging unit: for whether depositing according to data qualification and subscription this subscription of attributive judgment request
It is in physical memory, the most then will be stored in physical memory and ask corresponding with this subscription
Subscription data send to client, otherwise, perform transmitting element;
Transmitting element: for the data qualification asked according to this subscription with subscribe to attribute from disk
Process obtains subscribing to data, this subscription request is added to physical memory, and by subscription
According to storing to physical memory, and these subscription data are sent to client.
Preferably, described physical memory is provided with a subscription table, in described judging unit " according to
Whether data qualification and subscription this subscription of attributive judgment request are present in physical memory " it is specially
Whether it is present in subscription table according to data qualification and subscription this subscription of attributive judgment request;Described
This subscription request " is added to physical memory " by transmitting element and is specially and this subscription is asked
Add to subscription table.
Preferably, described data qualification is a Boolean expression, and this Boolean expression includes at least
One relational expression, described relational expression includes field, operator, correction data, right
Than part and additional information.
Preferably, described subscription attribute includes ID, subscribes to duration, field attribute, complete
One or more in portion's subscription, part subscription, subscription sequence and paging information.
Preferably, described subscription sequence includes needing sort field and sort type, described sequence class
Type includes ascending order and descending;Described paging information includes starting quantity and terminates quantity.
Compared to existing technology, beneficial effects of the present invention is as follows:
The present invention uses physical memory cache data, and access efficiency is high, it is not necessary to and disk is mutual;
Data, services shifts, and after client sends subscription request for the first time, service end please by this subscription
Seek caching, then ask in this subscription of background process, it is to avoid during client subscription data frequently
Calculate and spend the time.
Accompanying drawing explanation
Fig. 1 is the workflow diagram of the quick method for subscribing of data of the present invention.
Detailed description of the invention
Below, in conjunction with accompanying drawing and detailed description of the invention, the present invention is described further:
Seeing Fig. 1, the present invention provides a kind of quick method for subscribing of data, the method application service
In processor in end, in service end, there is physical memory and disk, and in physics
A subscription table it is provided with in depositing.Client, in order to understand relevant information, sends the request of subscription to clothes
Business end, service end is stored in relevant information, returns data into client according to the content of the request of subscribing to
End, specifically comprises the following steps that
Step S1: receiving the subscription from client and ask, described subscription request includes data
Condition and subscription attribute;
Data qualification refers to the data demand needing to present, and subscribes to attribute and refers to that service end is finally returned
It is back to the call format of the data of client, such as by the sequence of certain attribute, paging return etc..
Data qualification is single set condition, and condition is a Boolean expression, and Boolean expression is by one
Individual or multiple relational expression compositions.Condition must have one group of logical expression, operator
Can be and or or or not, when relation is not, inside group, only allow one
Individual sub-condition.Such as:
Element minimum in condition is relational expression, relational expression attribute be respectively field,
Operator, correction data, contrast part and additional information five part composition.
Subscribe to the action part that attribute is rule, according to the different demands of client the most not
With.The subscription attribute of once subscribing to request be presented herein below:
The ID that USER_ID tag representation is subscribed to.SUB_TYPE represents subscription type, STAT
Representing statistics, LIST represents data list.ALL represents all subscription.SUB_MINUTES table
Show subscription duration, only subscribe to the data of nearest N minute.UB_FIELD represents field attribute,
ORDER represents that sequence, FIELD represent the field that needs sort, and TYPE represents sort type:
ASC (ascending order), DESC (descending).PAGE represents the paging information of request, START table
Show that starting quantity, END represent end quantity.
Step S2: whether be present according to data qualification and subscription this subscription of attributive judgment request
In physical memory, the most then will be stored in asking corresponding ordering in physical memory and with this subscription
Read data to send to client, otherwise, perform step S3;
Concrete, according to data qualification, this orders the physical memory in service end with subscribing to attributive judgment
Whether the request of readding is present in subscription table.
Step S3: the data qualification asked according to this subscription and subscription attribute process from disk
Obtain subscribing to data, this subscription request is added to physical memory, and subscription data are deposited
Store up to physical memory, and these subscription data are sent to client.
Concrete, this subscription request is added to subscription table, carries out real-time update, work as user
First whether query subscription table exists when sending subscription request, order if there is the most directly transferring
Read data and return these subscription data to client, if there is no then initialization data and preserve extremely
Subscription table.When not receiving the subscription request preserved in subscription table for a long time, then delete this and order
Read request, prevent junk data committed memory and affect performance.
On the other hand, the data that the present invention also provides for a kind of method for subscribing quick with data corresponding are fast
Speed subscribes to device, is applied in the processor of service end, has physical memory and magnetic in service end
Dish, it include receive unit: for receive from client subscription ask, described subscription please
Ask and include data qualification and subscribe to attribute;Judging unit: for belonging to according to data qualification and subscription
Property judge this subscription request whether be present in physical memory, the most then will be stored in physics
Ask corresponding subscription data to send to client in depositing and with this subscription, otherwise, perform transmission
Unit;Transmitting element: for the data qualification asked according to this subscription with subscribe to attribute from disk
Middle process obtains subscribing to data, this subscription request is added to physical memory, and will subscribe to
Data store to physical memory, and send these subscription data to client.
Accordingly, physical memory is provided with a subscription table, " according to data in described judging unit
Whether condition and subscription this subscription of attributive judgment request are present in physical memory " it is specially basis
Whether data qualification and subscription this subscription of attributive judgment request are present in subscription table;Described transmission
This subscription request " is added to physical memory " to be specially by unit this subscription request is added
To subscription table.
Data qualification is a Boolean expression, and this Boolean expression includes at least one relationship expression
Formula, described relational expression includes field, operator, correction data, contrast part and adds
Information.Subscribe to attribute to include ID, subscribe to duration, field attribute, all subscription, portion
One or more divide subscription, subscribing in sequence and paging information.Described subscription sequence includes needing
Sort field and sort type, described sort type includes ascending order and descending;Described paging information
Including starting quantity and end quantity.
It will be apparent to those skilled in the art that can technical scheme as described above and structure
Think, make other various corresponding changes and deformation, and all these changes and deformation
Within all should belonging to the protection domain of the claims in the present invention.