• Webinars
  • Docs
  • Download
  • Blogs
  • Contact Us
Try NCache Live
Show / Hide Table of Contents

Registering Non-Generic Classes

You can use either of the two ways described below to register your classes for compact serialization.

Important

For Java, before deploying your JAR files, you need to make sure that:

  • You have JDK 11 installed
  • Your Environment Variable for Java is set

Using NCache Web Manager

  • Launch NCache Web Manager by browsing to http://localhost:8251 (Windows) or <server-ip>:8251 (Windows + Linux).

  • In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache to configure.

  • Against the cache name, click on View Details.

View Details Compact Serialization Web

  • This opens up the detailed configuration page for the cache. Go to the Advanced Settings tab and click on Compact Serialization in the left bar.

  • Click the Add Types button, a new Select Compact Classes dialog box will open up.

Add Types for Compact Serialization Web

  • Against Library, click on "..." and select the required file which contains the classes. The classes will be listed from the selected assembly in Loaded Class list box.

  • Select the desired classes, which you want to register with NCache for compact serialization, and click Add Classes.

Add Classes for Compact Serialization Web

  • Click OK to add classes. It lists fully qualified names of all selected classes in Compact Serialization tab.

Configure Compact Serialization Web

  • Click on Save Changes to apply this configuration to the cache.

Using PowerShell

Add-CompactType cmdlet enables the user to register a custom object for compact serialization for the given caches.

This command defines a compact type for demoClusteredCache. You can define further types one by one repeating the step for other types.

Add-CompactType -CacheName demoClusteredCache -AssemblyPath C:\Data.dll -Class Alachisoft.NCache.Sample.Data.Customer
Add-CompactType -CacheName demoClusteredCache -AssemblyPath C:\Data.dll -Class Alachisoft.NCache.Sample.Data.Customer -NonCompactAttributes hireDate

Using Tools (Java)

  • Open the NCache tools directory using the following command:
$cd ~/%NCHOME%/bin/tools
  • Use the addcompacttype tool to register custom objects for compact serialization.
./addcompacttypedemoCache -a ~/Data.jar –c alachisoft.sample.data.compact.Engineer
./addcompacttypedemoCache -a ~/Data.jar -c alachisft.sample.data.compact.Manager –al pay

Engineer class is marked compact and added to configuration of demoCache.

See Also

Unregister Non-Generic Classes
Register Generic Classes
Register Generic Classes using Generic Type Handler
Register Classes for Portable Data Sharing

Back to top Copyright © 2017 Alachisoft