public WorkerRole AddAzureCacheWorkerRoleProcess(string workerRoleName, int instances, string rootPath) { // Create cache worker role. Action <string, RoleInfo> cacheWorkerRoleAction = CacheConfigurationFactory.GetCacheRoleConfigurationAction( AzureTool.GetAzureSdkVersion()); CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null); RoleInfo genericWorkerRole = cloudServiceProject.AddWorkerRole( Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), workerRoleName, instances); // Dedicate the worker role for caching. cacheWorkerRoleAction(cloudServiceProject.Paths.RootPath, genericWorkerRole); cloudServiceProject.Reload(); WorkerRole cacheWorkerRole = cloudServiceProject.Components.GetWorkerRole(genericWorkerRole.Name); // Write output SafeWriteOutputPSObject( cacheWorkerRole.GetType().FullName, Parameters.CacheWorkerRoleName, genericWorkerRole.Name, Parameters.Instances, genericWorkerRole.InstanceCount ); return(cloudServiceProject.Components.GetWorkerRole(workerRoleName)); }
protected override void Configure(Dictionary <string, string> environment) { if (string.IsNullOrEmpty(this.Version)) { string version; if (!environment.TryGetValue(Resources.CacheRuntimeVersionKey, out version)) { version = AzureTool.GetAzureSdkVersion(); } this.Version = version; } }
public EnableAzureMemcacheRoleCommand() { CacheRuntimeVersion = AzureTool.GetAzureSdkVersion(); }