The invention discloses a method and a device for storing data and belongs to the technical field of computers. The method comprises the following steps of: configuring an extensible two-dimensional data cache array into a local shared memory according to a preset configuration strategy, wherein the two-dimensional data cache array comprises a plurality of logic data blocks, and each logic data block comprises a plurality of subdata blocks used for storing the data; and loading data in a network storage device into the corresponding subdata blocks according to the business logic requirement. According to the method and the device for storing the data disclosed by the invention, through configuring the extensible two-dimensional data cache array into the local shared memory according to the preset configuration strategy, and loading the data in the network storage device into the corresponding subdata blocks of the two-dimensional data cache array according to the business logic requirement, local data storage is realized, and therefore, the efficiency of data storage and interaction can be improved. Moreover, as the two-dimensional data cache array for storing the data is extensible, the extendibility of a data structure is improved, and the business logic requirement can be met.