- Updating Device Data
- Web Apps
- Reference Pages
- Useful Links
- Supported Versions
This tutorial illustrates how to create a 51Degrees device detection dataset with a custom caching configuration.
Code and Explanation
This Example shows how to:
use DataSetBuilder to supply a custom cache configuration to
the 51 Degrees device detection API.
Dataset dataset = DatasetBuilder.file() .configureCachesFromCacheSet(DatasetBuilder.CacheTemplate.MultiThreadLowMemory) .setCacheBuilder(NodesCache, builder) .setCacheBuilder(ProfilesCache, null) .lastModified(new Date()) .build(Shared.getLitePatternV32());
In this tutorial you have seen how to use DataSetBuilder to create a dataset with a custom cache configuration.
The example uses the Guava cache but the same principle could be applied to any 3rd party cache implementation.
The 51 Degrees API has been tested extensively to determine the best caching strategies and parameters for a wide range of environments and use cases. Care should be taken when using a custom configuration to ensure that performance is not degraded unintentionally.