The present invention discloses the core of a graph database ID caching technology, the dynamic caching is applied to the graph databases with millions or more of data, and the ID caching technology caches IDs in memory, although the graph database will still be queried. However, compared with the original query process of traversing millions of data, the speed of query is much faster, and the amount of query is very small, so that the query speed is also greatly improved, and the data dynamic, the data changes in the database and the cache do not conflict, greatly reducing the probability ofdirty data. The device is divided into the following parts of a special cache structure based on the structural characteristics of graph database, different matching strategies for simple query and complex query, updating cache to achieve consistency when the database is changed, and replacement strategy when the number of caches is too large.