With the explosive growth of wireless data, mobile edge caching has emerged as a promising paradigm to support mobile traffic recently, in which the service providers (SPs) prefetch some popular contents in advance and cache them locally at the network edge. When requested, those locally cached contents can be directly delivered to users with low latency, thus alleviating the traffic load over backhaul channels during peak hours and enhancing the quality-of-experience (QoE) of users simultaneously. Due to the limited available cache space, it makes sense for the SP to cache the most profitable contents. Nevertheless, users' true valuations of contents are their private knowledge, which is unknown to the SP in general. This information asymmetry poses a significant challenge for effective caching at the SP side. Further, the cached contents can be delivered with different quality, which needs to be chosen judiciously to balance delivery costs and user satisfaction. To tackle these difficulties, in this paper, we propose an optimal auction mechanism from the perspective of the SP. In the auction, the SP determines the cache space allocation over contents and user payments based on the users' (possibly untruthful) reports of their valuations so that the SP's expected revenue is maximized. The advocated mechanism is designed to elicit true valuations from the users (incentive compatibility) and to incentivize user participation (individual rationality). In addition, we devise a computationally efficient method for calculating the optimal cache space allocation and user payments. We further examine the optimal choice of the content delivery quality for the case with a large number of users and derive a closed-form solution to compute the optimal delivery quality. Finally, extensive simulations are implemented to evaluate the performance of the proposed optimal auction mechanism, and the impact of various model parameters is highlighted to obtain engineering insights into the content caching problem.