We state and solve a problem of the optimal geographic caching of content in cellular networks, where linear combinations of contents are stored in the caches of base stations. We consider a general content popularity distribution and a general distribution of the number of stations covering the typical location in the network. We are looking for a policy of content caching maximizing the probability of serving the typical content request from the caches of covering stations. The problem has a special form of monotone sub-modular set function maximization. Using dynamic programming, we find a deterministic policy solving the problem. We also consider two natural greedy caching policies. We evaluate our policies considering two popular stochastic geometric coverage models: the Boolean one and the Signal-to-Interference-and-Noise-Ratio one, assuming Zipf popularity distribution. Our numerical results show that the proposed deterministic policies are in general not worse than some randomized policy considered in the literature and can further improve the total hit probability in the moderately high coverage regime.